0

i got a function of 5 variables Fx(s,m,p,h,l)

import numpy as np
s= np.arange(0,135,15)/10
m= np.array([150,180,195,210,240,255,270,285,300])
p=np.array([-1.5,-1,-0.5,0,0.5,1,1.5])
h=np.array([0,3,6,9,12])
l=np.array([0,0.5,1,1.5,2,2.5,3,4])

and 180 values of the function in a csv file. i would like to calculate missing value by interpolation in all points and use radial basis function thin_plate will by great. is it possible? for information i found here Python 4D linear interpolation on a rectangular grid InterpolatingFunction but if i replace some value in data array by None, at this point f(point) give 'nan'. and i don t want to use a linear interpolation because for a set of 4 variables i got 2 points with a value. thanks very much for helping LL

Community
  • 1
  • 1
lolo
  • 1
  • 2

1 Answers1

0

Try SVR from scikit-learn to solve your problem:

from sklearn.svm import SVR # it uses RBF as default kernel
import numpy as np

n_samples, n_features = 180, 5

y = np.random.randn(n_samples)  #function values
X = np.random.randn(n_samples, n_features)   #points
clf = SVR(C=1.0, epsilon=0.2)
clf.fit(X, y)

#Get value at a new point:

clf.predict([0,150,-1.5,0,0]) 

Because of len(s)*len(m)*len(p)*len(h)*len(l) is 22680 and function values are known only in 180 points, you have poor information about your function....

bubble
  • 1,634
  • 12
  • 17
  • hi, thank you a lot, it work, but how can i fix parameters to make the function going exactly through my given values at points ??? – lolo Apr 24 '14 at 03:49
  • it work perfectly, with C=100000 the function going very close to my given values. but i can't find, how to give more weight to just certain variables like v or m for example? – lolo Apr 24 '14 at 04:07