liveBook · Manning

Matérn kernel

As explained in Bayesian Optimization in Action

A Matérn kernel is a covariance function whose smoothness is controlled by a parameter that determines the finite differentiability of functions drawn from the associated Gaussian process.

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

How Bayesian Optimization in Action covers it

How deep it goes
Maps three supported ν values to differentiability and demonstrates their predictive behavior without deriving the covariance formula.
Examples
Uses stock-price time series, ν = 1/2, ν = 3/2, ν = 5/2, and GPyTorch prediction visualizations.
What it assumes
Assumes Gaussian-process and covariance-function context while defining smoothness through differentiability.
What you can do after
Operate/configure it via GPyTorch by selecting ν for a Gaussian-process model’s desired smoothness.
How it connects
Connects Gaussian processes, covariance functions, RBF kernels, Bayesian optimization, and length scales.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bayesian Optimization in Action. The section links point to the parts of the book it draws on.