ezyrb.approximation.rbf.RBF

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

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))
__init__(kernel='thin_plate_spline', smooth=0, neighbors=None, epsilon=None, degree=None)[source]

Methods

__init__([kernel, smooth, neighbors, ...])

fit(points, values)

Construct the interpolator given points and values.

predict(new_point)

Evaluate interpolator at given new_points.