Skip to content

Commit

Permalink
chore: format the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
sathvikbhagavan committed Dec 13, 2023
1 parent f99e8d6 commit 9224fd8
Show file tree
Hide file tree
Showing 30 changed files with 730 additions and 349 deletions.
12 changes: 6 additions & 6 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ using Plots
include("pages.jl")

makedocs(sitename = "Surrogates.jl",
linkcheck = true,
warnonly = [:missing_docs],
format = Documenter.HTML(analytics = "UA-90474609-3",
assets = ["assets/favicon.ico"],
canonical = "https://docs.sciml.ai/Surrogates/stable/"),
pages = pages)
linkcheck = true,
warnonly = [:missing_docs],
format = Documenter.HTML(analytics = "UA-90474609-3",
assets = ["assets/favicon.ico"],
canonical = "https://docs.sciml.ai/Surrogates/stable/"),
pages = pages)

deploydocs(repo = "github.com/SciML/Surrogates.jl.git")
76 changes: 38 additions & 38 deletions docs/pages.jl
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
pages = ["index.md"
"Tutorials" => [
"Basics" => "tutorials.md",
"Radials" => "radials.md",
"Kriging" => "kriging.md",
"Gaussian Process" => "abstractgps.md",
"Lobachevsky" => "lobachevsky.md",
"Linear" => "LinearSurrogate.md",
"InverseDistance" => "InverseDistance.md",
"RandomForest" => "randomforest.md",
"SecondOrderPolynomial" => "secondorderpoly.md",
"NeuralSurrogate" => "neural.md",
"Wendland" => "wendland.md",
"Polynomial Chaos" => "polychaos.md",
"Variable Fidelity" => "variablefidelity.md",
"Gradient Enhanced Kriging" => "gek.md",
"GEKPLS" => "gekpls.md",
"MOE" => "moe.md",
"Parallel Optimization" => "parallel.md"
]
"User guide" => [
"Samples" => "samples.md",
"Surrogates" => "surrogate.md",
"Optimization" => "optimizations.md",
]
"Benchmarks" => [
"Sphere function" => "sphere_function.md",
"Lp norm" => "lp.md",
"Rosenbrock" => "rosenbrock.md",
"Tensor product" => "tensor_prod.md",
"Cantilever beam" => "cantilever.md",
"Water Flow function" => "water_flow.md",
"Welded beam function" => "welded_beam.md",
"Branin function" => "BraninFunction.md",
"Ackley function" => "ackley.md",
"Gramacy & Lee Function" => "gramacylee.md",
"Salustowicz Benchmark" => "Salustowicz.md",
"Multi objective optimization" => "multi_objective_opt.md",
]]
"Tutorials" => [
"Basics" => "tutorials.md",
"Radials" => "radials.md",
"Kriging" => "kriging.md",
"Gaussian Process" => "abstractgps.md",
"Lobachevsky" => "lobachevsky.md",
"Linear" => "LinearSurrogate.md",
"InverseDistance" => "InverseDistance.md",
"RandomForest" => "randomforest.md",
"SecondOrderPolynomial" => "secondorderpoly.md",
"NeuralSurrogate" => "neural.md",
"Wendland" => "wendland.md",
"Polynomial Chaos" => "polychaos.md",
"Variable Fidelity" => "variablefidelity.md",
"Gradient Enhanced Kriging" => "gek.md",
"GEKPLS" => "gekpls.md",
"MOE" => "moe.md",
"Parallel Optimization" => "parallel.md",
]
"User guide" => [
"Samples" => "samples.md",
"Surrogates" => "surrogate.md",
"Optimization" => "optimizations.md",
]
"Benchmarks" => [
"Sphere function" => "sphere_function.md",
"Lp norm" => "lp.md",
"Rosenbrock" => "rosenbrock.md",
"Tensor product" => "tensor_prod.md",
"Cantilever beam" => "cantilever.md",
"Water Flow function" => "water_flow.md",
"Welded beam function" => "welded_beam.md",
"Branin function" => "BraninFunction.md",
"Ackley function" => "ackley.md",
"Gramacy & Lee Function" => "gramacylee.md",
"Salustowicz Benchmark" => "Salustowicz.md",
"Multi objective optimization" => "multi_objective_opt.md",
]]
4 changes: 2 additions & 2 deletions lib/SurrogatesAbstractGPs/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using Surrogates: sample, SobolSample
x_points = sample(5, lb, ub, SobolSample())
y_points = f.(x_points)
agp1D = AbstractGPSurrogate([x_points[1]], [y_points[1]],
gp = GP(SqExponentialKernel()), Σy = 0.05)
gp = GP(SqExponentialKernel()), Σy = 0.05)
x_new = 2.5
y_actual = f.(x_new)
for i in 2:length(x_points)
Expand Down Expand Up @@ -88,7 +88,7 @@ using Surrogates: sample, SobolSample
b = 6
my_k_EI1 = AbstractGPSurrogate(x, y)
surrogate_optimize(objective_function, EI(), a, b, my_k_EI1, RandomSample(),
maxiters = 200, num_new_samples = 155)
maxiters = 200, num_new_samples = 155)
end

@testset "Optimization ND" begin
Expand Down
6 changes: 3 additions & 3 deletions lib/SurrogatesFlux/src/SurrogatesFlux.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ NeuralSurrogate(x,y,lb,ub,model,loss,opt,n_echos)
"""
function NeuralSurrogate(x, y, lb, ub; model = Chain(Dense(length(x[1]), 1), first),
loss = (x, y) -> Flux.mse(model(x), y), opt = Descent(0.01),
n_echos::Int = 1)
loss = (x, y) -> Flux.mse(model(x), y), opt = Descent(0.01),
n_echos::Int = 1)
X = vec.(collect.(x))
data = zip(X, y)
ps = Flux.params(model)
Expand Down Expand Up @@ -59,7 +59,7 @@ function add_point!(my_n::NeuralSurrogate, x_new, y_new)
end
X = vec.(collect.(my_n.x))
data = zip(X, my_n.y)
for epoch in 1:my_n.n_echos
for epoch in 1:(my_n.n_echos)
Flux.train!(my_n.loss, my_n.ps, data, my_n.opt)
end
nothing
Expand Down
16 changes: 8 additions & 8 deletions lib/SurrogatesFlux/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ using SafeTestsets
my_opt = Descent(0.01)
n_echos = 1
my_neural = NeuralSurrogate(x, y, a, b, model = my_model, loss = my_loss, opt = my_opt,
n_echos = 1)
n_echos = 1)
my_neural_kwargs = NeuralSurrogate(x, y, a, b)
add_point!(my_neural, 8.5, 20.0)
add_point!(my_neural, [3.2, 3.5], [7.4, 8.0])
Expand All @@ -37,7 +37,7 @@ using SafeTestsets
my_opt = Descent(0.01)
n_echos = 1
my_neural = NeuralSurrogate(x, y, lb, ub, model = my_model, loss = my_loss,
opt = my_opt, n_echos = 1)
opt = my_opt, n_echos = 1)
my_neural_kwargs = NeuralSurrogate(x, y, lb, ub)
my_neural((3.5, 1.49))
my_neural([3.4, 1.4])
Expand All @@ -54,7 +54,7 @@ using SafeTestsets
my_model = Chain(Dense(1, 2))
my_loss(x, y) = Flux.mse(my_model(x), y)
surrogate = NeuralSurrogate(x, y, lb, ub, model = my_model, loss = my_loss,
opt = my_opt, n_echos = 1)
opt = my_opt, n_echos = 1)
surr_kwargs = NeuralSurrogate(x, y, lb, ub)

f = x -> [x[1], x[2]^2]
Expand All @@ -66,7 +66,7 @@ using SafeTestsets
my_model = Chain(Dense(2, 2))
my_loss(x, y) = Flux.mse(my_model(x), y)
surrogate = NeuralSurrogate(x, y, lb, ub, model = my_model, loss = my_loss,
opt = my_opt, n_echos = 1)
opt = my_opt, n_echos = 1)
surrogate_kwargs = NeuralSurrogate(x, y, lb, ub)
surrogate((1.0, 2.0))
x_new = (2.0, 2.0)
Expand All @@ -85,7 +85,7 @@ using SafeTestsets
n_echos = 1
my_neural_ND_neural = NeuralSurrogate(x, y, lb, ub)
surrogate_optimize(objective_function_ND, SRBF(), lb, ub, my_neural_ND_neural,
SobolSample(), maxiters = 15)
SobolSample(), maxiters = 15)

# AD Compatibility
lb = 0.0
Expand All @@ -101,7 +101,7 @@ using SafeTestsets
my_opt = Descent(0.01)
n_echos = 1
my_neural = NeuralSurrogate(x, y, lb, ub, model = my_model, loss = my_loss,
opt = my_opt, n_echos = 1)
opt = my_opt, n_echos = 1)
g = x -> my_neural'(x)
g(3.4)
end
Expand All @@ -120,7 +120,7 @@ using SafeTestsets
my_opt = Descent(0.01)
n_echos = 1
my_neural = NeuralSurrogate(x, y, lb, ub, model = my_model, loss = my_loss,
opt = my_opt, n_echos = 1)
opt = my_opt, n_echos = 1)
g = x -> Zygote.gradient(my_neural, x)
g((2.0, 5.0))
end
Expand All @@ -141,7 +141,7 @@ using SafeTestsets
my_opt = Descent(0.01)
n_echos = 1
my_neural = NeuralSurrogate(x, y, lb, ub, model = my_model, loss = my_loss,
opt = my_opt, n_echos = 1)
opt = my_opt, n_echos = 1)
Zygote.gradient(x -> sum(my_neural(x)), (2.0, 5.0))

my_rad = RadialBasis(x, y, lb, ub, rad = linearRadial())
Expand Down
151 changes: 151 additions & 0 deletions lib/SurrogatesMOE/X-QMC2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
1,2
-0.9765625,-0.3359375
0.0234375,0.6640625
0.5234375,-0.8359375
-0.4765625,0.1640625
-0.2265625,-0.5859375
0.7734375,0.4140625
0.2734375,-0.0859375
-0.7265625,0.9140625
-0.6015625,-0.9609375
0.3984375,0.0390625
0.8984375,-0.4609375
-0.1015625,0.5390625
-0.3515625,-0.2109375
0.6484375,0.7890625
0.1484375,-0.7109375
-0.8515625,0.2890625
-0.7890625,-0.6484375
0.2109375,0.3515625
0.7109375,-0.1484375
-0.2890625,0.8515625
-0.0390625,-0.3984375
0.9609375,0.6015625
0.4609375,-0.8984375
-0.5390625,0.1015625
-0.6640625,-0.0234375
0.3359375,0.9765625
0.8359375,-0.5234375
-0.1640625,0.4765625
-0.4140625,-0.7734375
0.5859375,0.2265625
0.0859375,-0.2734375
-0.9140625,0.7265625
-0.8828125,-0.8671875
0.1171875,0.1328125
0.6171875,-0.3671875
-0.3828125,0.6328125
-0.1328125,-0.1171875
0.8671875,0.8828125
0.3671875,-0.6171875
-0.6328125,0.3828125
-0.5078125,-0.4921875
0.4921875,0.5078125
0.9921875,-0.9921875
-0.0078125,0.0078125
-0.2578125,-0.7421875
0.7421875,0.2578125
0.2421875,-0.2421875
-0.7578125,0.7578125
-0.8203125,-0.1796875
0.1796875,0.8203125
0.6796875,-0.6796875
-0.3203125,0.3203125
-0.0703125,-0.9296875
0.9296875,0.0703125
0.4296875,-0.4296875
-0.5703125,0.5703125
-0.6953125,-0.5546875
0.3046875,0.4453125
0.8046875,-0.0546875
-0.1953125,0.9453125
-0.4453125,-0.3046875
0.5546875,0.6953125
0.0546875,-0.8046875
-0.9453125,0.1953125
-0.9609375,-0.6015625
0.0390625,0.3984375
0.5390625,-0.1015625
-0.4609375,0.8984375
-0.2109375,-0.3515625
0.7890625,0.6484375
0.2890625,-0.8515625
-0.7109375,0.1484375
-0.5859375,-0.2265625
0.4140625,0.7734375
0.9140625,-0.7265625
-0.0859375,0.2734375
-0.3359375,-0.9765625
0.6640625,0.0234375
0.1640625,-0.4765625
-0.8359375,0.5234375
-0.7734375,-0.4140625
0.2265625,0.5859375
0.7265625,-0.9140625
-0.2734375,0.0859375
-0.0234375,-0.6640625
0.9765625,0.3359375
0.4765625,-0.1640625
-0.5234375,0.8359375
-0.6484375,-0.7890625
0.3515625,0.2109375
0.8515625,-0.2890625
-0.1484375,0.7109375
-0.3984375,-0.0390625
0.6015625,0.9609375
0.1015625,-0.5390625
-0.8984375,0.4609375
-0.9296875,-0.0703125
0.0703125,0.9296875
0.5703125,-0.5703125
-0.4296875,0.4296875
-0.1796875,-0.8203125
0.8203125,0.1796875
0.3203125,-0.3203125
-0.6796875,0.6796875
-0.5546875,-0.6953125
0.4453125,0.3046875
0.9453125,-0.1953125
-0.0546875,0.8046875
-0.3046875,-0.4453125
0.6953125,0.5546875
0.1953125,-0.9453125
-0.8046875,0.0546875
-0.8671875,-0.8828125
0.1328125,0.1171875
0.6328125,-0.3828125
-0.3671875,0.6171875
-0.1171875,-0.1328125
0.8828125,0.8671875
0.3828125,-0.6328125
-0.6171875,0.3671875
-0.7421875,-0.2578125
0.2578125,0.7421875
0.7578125,-0.7578125
-0.2421875,0.2421875
-0.4921875,-0.5078125
0.5078125,0.4921875
0.0078125,-0.0078125
-0.9921875,0.9921875
-0.98828125,-0.00390625
0.01171875,0.99609375
0.51171875,-0.50390625
-0.48828125,0.49609375
-0.23828125,-0.75390625
0.76171875,0.24609375
0.26171875,-0.25390625
-0.73828125,0.74609375
-0.61328125,-0.62890625
0.38671875,0.37109375
0.88671875,-0.12890625
-0.11328125,0.87109375
-0.36328125,-0.37890625
0.63671875,0.62109375
0.13671875,-0.87890625
-0.86328125,0.12109375
-0.80078125,-0.94140625
0.19921875,0.05859375
0.69921875,-0.44140625
-0.30078125,0.55859375
-0.05078125,-0.19140625
0.94921875,0.80859375
Loading

0 comments on commit 9224fd8

Please sign in to comment.