kailaix / ADCME.jl

Automatic Differentiation Library for Computational and Mathematical Engineering
https://kailaix.github.io/ADCME.jl/latest/
MIT License
286 stars 57 forks source link

The syntax of RBF3D using multiquadric radial? #71

Closed mdsa3d closed 3 years ago

mdsa3d commented 3 years ago

I would like to know how to implement rbf function on the following datasets? I know from the tutorials that there is RBF2D but i couldn't find tutorials for 3D radial using multiquadric radial. For example, I have the following dataset where I want to build rbf for training data and predict the values for testing data.

#training data
x = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0] 
y = [1.0, 3.0, 4.0, 4.0, 4.0, 4.0, 5.0, 5.0] 
z = [13.41, 8.6, 5.76, 3.58, 4.69, 3.72, 6.32, 5.68]

#testing data (for which z to be predicted)
x = [1.0, 1.0, 2.28, 2.28, 3.57, 3.57, 4.85, 6.14, 6.14, 6.14, 6.14, 7.42, 7.42, 8.71, 8.71, 10.0] 
y = [1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0]

May I know, is this supported by the package? And how can i achieve this operation?

kailaix commented 3 years ago

Your example seems to be a 2D problem ((x,y) are coordinates, and z is function values). Anyway, RBF3D has been added in the latest version. See this doc.

using ADCME
# centers 
xc = rand(10)
yc = rand(10)
zc = rand(10)
rbf = RBF3D(xc, yc, zc)

# coordinates
x = rand(20)
y = rand(20)
z = rand(20)
v = rbf(x, y, z)