blackbox
blackbox copied to clipboard
Added scipy RBF interpolation
The rbf() function is now called from standard scipy library.
Thanks! I'm actually getting different answers with new and old RBF. Any idea why?
points = np.array([[0., 0., 1.], [0., 1., 1.], [1., 0., 1.], [1., 1., 1.], [0.5, 0.5, 0.]])
test_point = [0.3, 0.3]
old_fit = rbf_old(points)
print(old_fit(test_point))
new_fit = rbf(*np.transpose(points), function='cubic')
print(new_fit(*test_point))
It looks like you have an additional polynomial bt x + a in the interpolation function
https://arxiv.org/pdf/1605.00998.pdf (equation 4)
while scipy uses only the first "sum-lambda-phi" term by default:
https://github.com/scipy/scipy/blob/adc4f4f7bab120ccfab9383aba272954a0a12fb0/scipy/interpolate/rbf.py#L290
self._function(r)
here is your basis function phi(r)
and self.nodes
are weights lambda, so they simply calculate their dot product and that is it. As far as I see there are no options to extend your interpolation function with any kind of polynomial in scipy.
I'm pretty sure it's true, cause I coded my own rbf without extra terms and get exactly the same results as I get in the standard library.