Skip to content

Commit

Permalink
Merge pull request #202 from TeAmP0is0N/patch-6
Browse files Browse the repository at this point in the history
Update kriging.md
  • Loading branch information
ludoro committed Jul 12, 2020
2 parents fd64986 + acbddc4 commit 5e817a7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/src/kriging.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ x = sample(n_samples, lower_bound, upper_bound, SobolSample())
y = f.(x)
scatter(x, y, label="Sampled points", xlims=(lower_bound, upper_bound), ylims=(-7, 17))
plot!(xs, f.(xs), label="True function")
plot!(xs, f.(xs), label="True function", legend=:top)
```
### Building a surrogate

Expand All @@ -40,9 +40,9 @@ With our sampled points we can build the Kriging surrogate using the `Kriging` f
```@example kriging_tutorial1d
kriging_surrogate = Kriging(x, y, lower_bound, upper_bound, p=1.9);
plot(x, y, seriestype=:scatter, label="Sampled points", xlims=(lower_bound, upper_bound), ylims=(-7, 17))
plot!(xs, f.(xs), label="True function")
plot!(xs, kriging_surrogate.(xs), label="Surrogate function", ribbon=p->std_error_at_point(kriging_surrogate, p))
plot(x, y, seriestype=:scatter, label="Sampled points", xlims=(lower_bound, upper_bound), ylims=(-7, 17), legend=:top)
plot!(xs, f.(xs), label="True function", legend=:top)
plot!(xs, kriging_surrogate.(xs), label="Surrogate function", ribbon=p->std_error_at_point(kriging_surrogate, p), legend=:top)
```
### Optimizing
Having built a surrogate, we can now use it to search for minimas in our original function `f`.
Expand All @@ -52,9 +52,9 @@ To optimize using our surrogate we call `surrogate_optimize` method. We choose t
```@example kriging_tutorial1d
@show surrogate_optimize(f, SRBF(), lower_bound, upper_bound, kriging_surrogate, SobolSample())
scatter(x, y, label="Sampled points", ylims=(-7, 7))
plot!(xs, f.(xs), label="True function")
plot!(xs, kriging_surrogate.(xs), label="Surrogate function", ribbon=p->std_error_at_point(kriging_surrogate, p))
scatter(x, y, label="Sampled points", ylims=(-7, 7), legend=:top)
plot!(xs, f.(xs), label="True function", legend=:top)
plot!(xs, kriging_surrogate.(xs), label="Surrogate function", ribbon=p->std_error_at_point(kriging_surrogate, p), legend=:top)
```


Expand Down

0 comments on commit 5e817a7

Please sign in to comment.