Wendland Surrogate
The Wendland surrogate is a compact surrogate: it allocates much less memory then other surrogates. The coefficients are found using an iterative solver.
$f = x -> exp(-x^2)$
using Surrogates
using Plots
n = 40
lower_bound = 0.0
upper_bound = 1.0
f = x -> exp(-x^2)
x = sample(n,lower_bound,upper_bound,SobolSample())
y = f.(x)
40-element Array{Float64,1}:
0.7415058221170969
0.5299303131915846
0.9156374719519708
0.8369604048668063
0.4274775461437875
0.6367258991486957
0.9708910551210944
0.9465498512981596
0.5831524464477202
0.3794645341647085
⋮
0.999450834440385
0.7603420992361533
0.5497973262437404
0.9279586861644862
0.8532075516884395
0.4461099014964117
0.6567372979278094
0.9782072773172401
0.956480737427535
We choose to sample f in 30 points between 5 to 25 using sample
function. The sampling points are chosen using a Sobol sequence, this can be done by passing SobolSample()
to the sample
function.
Building Surrogate
The choice of the right parameter is especially important here: a slight change in ϵ would produce a totally different fit. Try it yourself with this function!
my_eps = 0.5
wend = Wendland(x,y,lower_bound,upper_bound,eps=my_eps)
plot(x, y, seriestype=:scatter, label="Sampled points", xlims=(lower_bound, upper_bound), legend=:top)
plot!(f, label="True function", xlims=(lower_bound, upper_bound), legend=:top)
plot!(wend, label="Surrogate function", xlims=(lower_bound, upper_bound), legend=:top)