Matern¶
-
class
probnum.kernels.Matern(input_dim, lengthscale=1.0, nu=1.5)¶ Bases:
probnum.kernels.KernelMatern kernel.
Covariance function defined by \(k(x_0, x_1) = \frac{1}{\Gamma(\nu)2^{ \nu-1}}\big(\frac{\sqrt{2\nu}}{l} \lVert x_0 , x_1\rVert \big)^\nu K_\nu\big(\frac{\sqrt{2\nu}}{l} \lVert x_0 , x_1 \rVert \big)\), where \(K_\nu\) is a modified Bessel function. The Matern kernel generalizes the
ExpQuadkernel via its additional parameter \(\nu\) controlling the smoothness of the function. For \(\nu \rightarrow \infty\) the Matern kernel converges to theExpQuadkernel. A Gaussian process with Matern covariance function is \(\lceil \nu \rceil - 1\) times differentiable.- Parameters
See also
ExpQuadExponentiated Quadratic / RBF kernel.
Examples
>>> import numpy as np >>> from probnum.kernels import Matern >>> K = Matern(input_dim=1, lengthscale=0.1, nu=2.5) >>> K(np.linspace(0, 1, 3)[:, None]) array([[1.00000000e+00, 7.50933789e-04, 3.69569622e-08], [7.50933789e-04, 1.00000000e+00, 7.50933789e-04], [3.69569622e-08, 7.50933789e-04, 1.00000000e+00]])
Attributes Summary
Dimension of arguments of the covariance function.
Dimension of the evaluated covariance function.
Methods Summary
__call__(x0[, x1])Evaluate the kernel.
Attributes Documentation
-
input_dim¶ Dimension of arguments of the covariance function.
The dimension of inputs to the covariance function \(k : \mathbb{R}^{ d_{in}} \times \mathbb{R}^{d_{in}} \rightarrow \mathbb{R}^{d_{out} \times d_{out}}\).
- Return type
-
output_dim¶ Dimension of the evaluated covariance function.
The resulting evaluated kernel \(k(x_0, x_1) \in \mathbb{R}^{d_{out} \times d_{out}}\) has shape=(output_dim, output_dim).
- Return type
Methods Documentation
-
__call__(x0, x1=None)[source]¶ Evaluate the kernel.
Computes the covariance function at
x0andx1. If the inputs have more than one dimension the covariance function is evaluated pairwise for all observations determined by the first dimension ofx0andx1. If onlyx0is given the kernel matrix \(K=k(X_0, X_0)\) is computed.- Parameters
- Returns
shape=(), (output_dim, output_dim) or (n0, n1) or (n0, n1, output_dim, output_dim) – Kernel evaluated at
x0andx1or kernel matrix containing pairwise evaluations for all observations inx0(andx1).- Return type
cov