Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update makedocs syntax and few cleanups #452

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
- Core
version:
- '1'
- '1.6'
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
Expand Down
18 changes: 6 additions & 12 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@ using Plots
include("pages.jl")

makedocs(sitename = "Surrogates.jl",
strict = [
:doctest,
:linkcheck,
:parse_error,
:example_block,
# Other available options are
# :autodocs_block, :cross_references, :docs_block, :eval_block, :example_block, :footnote, :meta_block, :missing_docs, :setup_block
],
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",
]]
45 changes: 24 additions & 21 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,56 +113,59 @@ surrogate_optimize(f,SRBF(),lb,ub,my_lobachevsky,RandomSample())
value = my_lobachevsky(5.0)
```
## Reproducibility

```@raw html
<details><summary>The documentation of this SciML package was built using these direct dependencies,</summary>
```

```@example
using Pkg # hide
Pkg.status() # hide
```

```@raw html
</details>
```

```@raw html
<details><summary>and using this machine and Julia version.</summary>
```

```@example
using InteractiveUtils # hide
versioninfo() # hide
```

```@raw html
</details>
```

```@raw html
<details><summary>A more complete overview of all dependencies and their versions is also provided.</summary>
```

```@example
using Pkg # hide
Pkg.status(;mode = PKGMODE_MANIFEST) # hide
Pkg.status(; mode = PKGMODE_MANIFEST) # hide
```

```@raw html
</details>
```
```@raw html
You can also download the
<a href="
```
```@eval
using TOML
version = TOML.parse(read("../../Project.toml",String))["version"]
name = TOML.parse(read("../../Project.toml",String))["name"]
link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/Manifest.toml"
```
```@raw html
">manifest</a> file and the
<a href="
```

```@eval
using TOML
version = TOML.parse(read("../../Project.toml",String))["version"]
name = TOML.parse(read("../../Project.toml",String))["name"]
link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/Project.toml"
```
```@raw html
">project</a> file.
using Markdown
version = TOML.parse(read("../../Project.toml", String))["version"]
name = TOML.parse(read("../../Project.toml", String))["name"]
link_manifest = "https://github.com/SciML/" * name * ".jl/tree/gh-pages/v" * version *
"/assets/Manifest.toml"
link_project = "https://github.com/SciML/" * name * ".jl/tree/gh-pages/v" * version *
"/assets/Project.toml"
Markdown.parse("""You can also download the
[manifest]($link_manifest)
file and the
[project]($link_project)
file.
""")
```
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
Loading