I tried testing the kriging interpolation
using custom surrogate
function = Stheno
for a set of points scattered in 3D space.
The interpolated results from the testing doesn’t honors the actual data points.
May I know, what can be cause of such variations? I have attached my code for reference:
using Stheno, Surrogates, Plots
function f(x)
x1=x[1]
x2=x[2]
return (x1+x2)
end
#Sampling
function sam()
x = [1.0,1.0,10.0,10.0,3.5,6.5] .* 10
y = [1.0,10.0,10.0,1.0,5.0,5.0] .* 10
tuple = zip(x,y) |> collect
return tuple
end
xy = sam() # a combination of x and y coordinates
z = f.(xy) #[2.0,2.0,2.0,2.0,4.5,4.5] .*5 # z coordinates
# perform kriging interpolation using SthenoKriging custom function
surrogate = SthenoKriging(xy, z)
# prepare a test sample
function test_val()
x = range(1, 100.0, length = 101) |> collect
y = range(1, 100.0, length = 101) |> collect
tuple = zip(x,y) |> collect
return tuple
end
arr = test_val()
result_stheno_surrogate = [surrogate(i) for i in arr]
x, y = 1:100, 1:100
surface(x, y, (x, y) -> surrogate([x y]), dpi= 200)
xs = [a[1] for a in xy]
ys = [a[2] for a in xy]
zs = [2.0,2.0,2.0,2.0,4.5,4.5]
scatter!(xs, ys, zs, marker_z=zs)
Thanks !