Closed nguyenhoaiThanhbk2811 closed 5 years ago
Your data points should have size 20 x 3 since you have 20 points in 3 dimensions.
A simple example where you build a cubic RBF from 100 data points in 3 dimensions may look like this:
import numpy as np
from pySOT.surrogate import RBFInterpolant, CubicKernel, LinearTail
np.random.seed(0)
X = np.random.rand(100, 3)
y = np.sin(np.sum(X, 1))
rbf = RBFInterpolant(dim=3, kernel=CubicKernel(), tail=LinearTail(dim=3), eta=1e-6)
rbf.add_points(X, y)
print(rbf.predict(np.zeros((1, 3)))) # Should be close to 0
Output:
[[0.01681138]]
The functional form of the surrogate model depends on what model you're using. RBFs aren't easily interpretable from the model weights, but other models like polynomial regression are.
Hello,
My query is related to the above example.
Using your example above, I would like to build a cubic RBF over 20 points in 3*3 dimensions.
Does pySOT support this feature?
Thank you!
Hi Zosezhuo,
Can you clarify what you mean by 3*3
dimensions?
Hi
Specifically, I would like to do the following in 3 by 3 dimensions.
np.random.seed(0)
X = np.random.uniform(low=0.0, high=1.0, size=[3,3])
y= fun(X)
y2= fun2(X)
print(X)
print(y)
print(y2)
[[0.5488135 0.71518937 0.60276338]
[0.54488318 0.4236548 0.64589411]
[0.43758721 0.891773 0.96366276]]
134408.75071136828
3.144276104044118
When I tried to add points, I received the following output
rbf_cubic = RBFInterpolant(dim=[3,3], kernel=CubicKernel(), tail=LinearTail(dim=[3,3]), eta=1e-6)
rbf_cubic.add_points(X, y)
rbf_cubic.add_points(X, y2)
TypeError: unsupported operand type(s) for +: 'int' and 'list
Appreciate your time and help very much
An RBF interpolant is a function from R^d -> R. You need to pass in a matrix X
with shape (n, d)
and y
with shape (n,)
.
I have the three parameters (node1,node2,node2) with each parameters I have 20 values. nodes1 = np.array([0.05675, 0.05934, 0.05633, 0.0557 , 0.05702, 0.06401, 0.06322, 0.06571, 0.06099, 0.05832, 0.06196, 0.06463, 0.05507, 0.06351, 0.06287, 0.06122, 0.05407, 0.05985, 0.05774,0.06015])
nodes2 = np.array([0.9486, 0.9095, 0.9856, 0.9318, 1.0477, 1.0489,1.0663, 0.9184, 0.9646, 1.0345, 1.0168, 1.0565, 0.9727, 0.9907, 0.9277, 0.9548, 1.0933, 1.0751,1.0026, 1.0231])
nodes3 = np.array([51.813, 54.279, 52.659, 51.197 , 46.629, 49.791, 48.581, 54.799, 46.413, 47.078, 52.367, 48.204, 50.389, 45.402, 47.893, 50.796 , 49.332, 53.323, 53.713, 45.757])
with a group parameter of input I have a output values. So I have the 20 output values example: (node1_1,node2_1,node3_1)=(0.05675,0.9486,51.813) I have a output values = 0.0204232
output=np.array([0.0204232,0.0205054,0.0204971,0.0204463,0.0206686,0.0206678,0.0206883,0.0204627,0.020426,0.0206532,0.0206322,0.020677,0.0204431,0.0205319,0.0204508,0.0204115,0.020721,0.0206988,0.0206179,0.0206418])
How to estimate the surrogate model between (node1,node2,node3) with output? and how to know the detail equation of the surrogate model?
please help me, thanks you