Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Open In Colab

Best Fit Radial Basis Functions

Since RBFs were also solved using a linear system, the extension to least square regression is straightforward. Recall that since for most kernels φi(∥x−xi∥→∞)→0\varphi_i(\|x-x_i\| \rightarrow \infty)\rightarrow 0, the approximated function will go to zero far from the data.

The modern implementation of RBFs accounts for the global trend of the data through a polynomial least squares fit alongside normal RBFs for local features.

y(x)=∑iNωiφi(∥x−xi∥)+∑iNPi(xi)bi\begin{aligned} y(x) &= \sum_i^N \omega_i \varphi_i(\|x-x_i\|) + \sum_i^N P_i(x_i) b_i \end{aligned}

Where PiP_i is an order n<mn<m polynomial. The Numpy RBFInterpolator object fits this equation to:

[Φ(xi,xj)−λI]ω+P(xi)b=yiP(xi)Tω=0\begin{aligned} [\Phi(x_i, x_j) -\lambda I]\omega +P(x_i) b &= y_i \\ P(x_i)^T \omega &=0 \end{aligned}

where λ=0\lambda = 0 recovers an exact fit and λ>0\lambda > 0 effectively shifts the fitting of the xi=xjx_i=x_j terms to the best fit polynomial.

Example: Toy Gaussian over a Quadratic

Let’s sample a Gaussian placed over a quadratic function, and use a scipy.interpolate.RBFInterpolator over the sampled points to see how it recovers the true function.

Example: RBF Interpolation in 2D

We can also naturally extend RBFs to 2D surfaces, which is where they truly shine!