Kernel functions
Radial Basis Function (RBF)
Given
\[ K(X_1,X_2)=\sigma^2\exp\left(-\frac{||X_1-X_2||^2}{2\ell^2}\right) \]
- \(\sigma^2\) is the overall variance (where \(\sigma\) is also known as the amplitude) It determines the average distance of your function away from its mean. It can be interpreted as a scale factor.
- \(\ell\) the lengthscale. In general, you won’t be able to extrapolate more than \(\ell\) units away from your data.
import numpy as np
from sklearn.gaussian_process.kernels import RBF
42)
np.random.seed(
= (-4, 4)
xlim = np.expand_dims(np.linspace(*xlim, num=75), 1)
X = np.array([0.](0.))
zero
= 1.0
amplitude 1 = (amplitude**2) * RBF(length_scale=1)(X)
Σ2 = (amplitude**2) * RBF(length_scale=0.5)(X)
Σ= 0.5
amplitude 3 = (amplitude**2) * RBF(length_scale=1)(X) Σ