RBF

Module for Radial Basis Function Interpolation.

class RBF(kernel='thin_plate_spline', smooth=0, neighbors=None, epsilon=None, degree=None)[source]

Bases: Approximation

Multidimensional interpolator using Radial Basis Function.

Parameters:
  • kernel (str or callable) – The radial basis function; the default is ‘multiquadric’.

  • smooth (float) – values greater than zero increase the smoothness of the approximation. 0 is for interpolation (default), the function will always go through the nodal points in this case.

  • neighbors (int) – if specified, the value of the interpolant at each evaluation point will be computed using only the nearest data points. If None (default), all the data points are used by default.

  • epsilon (float) – Shape parameter that scales the input to the RBF. If kernel is ‘linear’, ‘thin_plate_spline’, ‘cubic’, or ‘quintic’, this defaults to 1 and can be ignored. Otherwise, this must be specified.

  • degree (int) – Degree of the added polynomial. The default value is the minimum degree for kernel or 0 if there is no minimum degree.

Variables:
  • kernel – The radial basis function; the default is ‘multiquadric’.

  • interpolator – the RBF interpolator

Example:
>>> import ezyrb
>>> import numpy as np
>>>
>>> x = np.random.uniform(-1, 1, size=(4, 2))
>>> y = np.array([np.sin(x[:, 0]), np.cos(x[:, 1]**3)]).T
>>> rbf = ezyrb.RBF()
>>> rbf.fit(x, y)
>>> y_pred = rbf.predict(x)
>>> print(np.allclose(y, y_pred))
_abc_impl = <_abc._abc_data object>
fit(points, values)[source]

Construct the interpolator given points and values.

Parameters:
  • points (array_like) – the coordinates of the points.

  • values (array_like) – the values in the points.

predict(new_point)[source]

Evaluate interpolator at given new_points.

Parameters:

new_points (array_like) – the coordinates of the given points.

Returns:

the interpolated values.

Return type:

numpy.ndarray