A Matérn kernel is a covariance function that controls how smooth functions sampled from a Gaussian process are. Here, smoothness means differentiability: unlike the infinitely differentiable RBF kernel, Matérn kernels produce functions with finite differentiability. The parameter ν sets that level, so larger ν produces smoother Gaussian-process behavior. section 3.4.2
The supported ν values map directly to function roughness:
- ν = 1/2 produces non-differentiable, highly jagged samples. section 3.4.2
- ν = 3/2 produces once-differentiable samples. section 3.4.2
- ν = 5/2 produces twice-differentiable samples that remain somewhat jagged. section 3.4.2
Choosing roughness
A value of ν = 1/2 can suit time-series data such as stock prices, where volatile changes are plausible. For Bayesian optimization, ν = 3/2 or ν = 5/2 offers a compromise: samples are smooth enough to learn from data while retaining realistic irregularity. section 3.4.2
class MaternGPModel(gpytorch.models.ExactGP):
def __init__(self, train_x, train_y, likelihood, nu):
super().__init__(train_x, train_y, likelihood)
self.mean_module = gpytorch.means.ZeroMean()
self.covar_module = gpytorch.kernels.MaternKernel(nu)
def forward(self, x):
... #1
Configure a Gaussian-process model with GPyTorch’s MaternKernel and pass ν as a model parameter. section 3.4.2
