# Interpolation for 3D data points does not honors the actual data using custom surrogates \`Stheno\`

**URL:** https://discourse.julialang.org/t/interpolation-for-3d-data-points-does-not-honors-the-actual-data-using-custom-surrogates-stheno/56687
**Category:** General Usage
**Tags:** question, interpolations
**Created:** [March 7, 2021, 4:48pm UTC](https://discourse.julialang.org/t/interpolation-for-3d-data-points-does-not-honors-the-actual-data-using-custom-surrogates-stheno/56687 "2021-03-07T16:48:06Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mdsa3d](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mdsa3d/32/20389_2.png) [@mdsa3d](https://discourse.julialang.org/u/mdsa3d)
#### Post date: [March 7, 2021, 4:48pm UTC](https://discourse.julialang.org/t/interpolation-for-3d-data-points-does-not-honors-the-actual-data-using-custom-surrogates-stheno/56687/1 "2021-03-07T16:48:06Z")

</div>

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:

```julia
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 !
