Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

SciPy · Function

interpolate.RBFInterpolator

RBFInterpolator builds a radial-basis-function model for scattered data in one or more dimensions. Configure its kernel, smoothing, polynomial degree, and optional nearest-neighbor localization, then call the instance at new coordinates.

How it works

Construct an interpolator from coordinates y and corresponding values d, then call the resulting object with new points. It combines a radial-basis kernel with an optional polynomial term; smoothing controls whether the fit exactly follows the data, while neighbors can restrict each evaluation to nearby samples.

Syntax

scipy.interpolate.RBFInterpolator(y, d, neighbors=None, smoothing=0.0, kernel='thin_plate_spline', epsilon=None, degree=None)

Parameters

NameTypeDescription
yarray_likeTwo-dimensional array of data-point coordinates with shape (npoints, ndims).
darray_likeData values at y with shape (npoints, ...); the first axis must match y.
neighborsint, optionalNumber of nearest data points used for each evaluation; all points are used by default.
smoothingfloat or (npoints,) array_like, optionalScalar or per-point smoothing parameter; zero gives an exact fit.
kernelstr, optionalRadial basis kernel, such as thin_plate_spline, linear, cubic, quintic, or multiquadric.
epsilonfloat, optionalShape parameter scaling the input to the RBF; required for some kernels and otherwise defaults to 1.
degreeint, optionalDegree of the polynomial added to the RBF model; the default depends on kernel.

Returns

An RBFInterpolator instance that can be called with new evaluation coordinates to produce interpolated values.

Key points

  • neighbors enables local interpolation based on a fixed count of nearest samples.
  • The default zero smoothing gives an exact fit at the input data points.
  • Large smoothing values favor polynomial least-squares behavior over exact interpolation.
  • epsilon rescales coordinates inside the radial basis function.

Common mistakes

  • Ensure d has one leading-axis entry for every coordinate in y.
  • Unlike some interpolators, this class always interprets the first axis of d as the data-point axis.

Example: Exact RBF interpolation

import numpy as np
from scipy.interpolate import RBFInterpolator

y = np.array([[0.0], [1.0], [2.0]])
d = np.sin(y[:, 0])
interpolant = RBFInterpolator(y, d, smoothing=0.0)

x = np.array([[0.5], [1.5]])
print(interpolant(x))

Creates an exact one-dimensional interpolant for sampled sine values and evaluates it at two new coordinates.

When to use it

Scattered-data interpolation

Estimate values between scattered measurements in one or more dimensions.

Smoothed surface fitting

Fit noisy observations without requiring an exact pass through every sample.

Localized interpolation

Evaluate large datasets using only nearby samples at each query.

Kernel-based function approximation

Use a chosen radial basis and polynomial component to model a smooth field.

Interview questions

QHow is RBFInterpolator used?

It accepts y as a two-dimensional array of point coordinates and d as values whose first dimension matches y. Calling the constructed object with evaluation coordinates returns interpolated values.

Follow-up: Why might neighbors be useful? It limits each evaluation to a specified number of nearest data points, reducing the local problem size and often improving scalability.

QWhat does smoothing control?

With smoothing equal to zero, the interpolant exactly fits the supplied data. Increasing smoothing moves the result toward a least-squares polynomial fit of the selected degree.

Follow-up: Can smoothing vary by sample? Yes. The parameter may be a scalar or an array with one value per data point.

QWhat roles do kernel, epsilon, and degree play?

The kernel determines the radial basis function, and epsilon scales the input for kernels that use a shape parameter. A polynomial degree can also be selected; its default depends on the kernel.

Follow-up: What constraint can arise from the polynomial term? The data coordinates must support the required polynomial system, and insufficiently diverse points can make the system singular.

  • scipy.interpolate.Rbf
  • scipy.interpolate.griddata
  • scipy.interpolate.RegularGridInterpolator

Source: scipy.interpolate.RBFInterpolator — SciPy v1.13.1 Manual. Checked 2026-10-15.