liveBook · Manning

Matérn 5/2 kernel

As explained in Bayesian Optimization in Action

A Matérn 5/2 kernel is a covariance kernel with Matérn smoothness parameter equal to five halves, producing twice-differentiable sample-function behavior under common parameterizations.

The Matérn 5/2 kernel is a covariance choice for Gaussian processes that balances smoothness with realistic roughness. Its samples are smoother than Matérn 3/2 or Matérn 1/2 samples while remaining jagged enough to model real-world objectives, making it a common default for Bayesian optimization. section 3.4.2

Use the kernel to:

  • Model expensive black-box objectives that require some smoothness for effective optimization. section 3.4.2
  • Customize behavior through a length scale and output scale, alongside a chosen mean function. section 3.4.2
  • Represent different input sensitivities with automatic relevance determination (ARD) length scales. section 3.5 section 12.4

Hyperparameter tuning

For an SVM accuracy surface over penalty parameter c and RBF parameter γ, train a constant-mean GP with a Matérn 5/2 kernel. Without ARD, it learns one length scale; with two-dimensional ARD, it learns separate scales, reflecting that the surface changes more quickly with γ than with c. section 3.5

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

A GPyTorch model skeleton places the Matérn kernel in the covariance module and passes the smoothness parameter through the constructor. section 3.4.2

How Bayesian Optimization in Action covers it

How deep it goes
Compares sample roughness and demonstrates GPyTorch configuration, while deferring detailed Matérn-kernel derivations.
Examples
Uses SVM accuracy tuning, airplane-design optimization, housing-price regression, and comparative Matérn sample figures.
What it assumes
Assumes Gaussian-process, covariance-function, PyTorch, and gradient-descent familiarity while practicing kernel configuration from provided patterns.
What you can do after
Apply it via GPyTorch by configuring a Matérn kernel, training its hyperparameters, and selecting ARD for multidimensional inputs.
How it connects
Connects covariance functions with Gaussian processes, mean functions, length scales, output scales, ARD, and Bayesian optimization.

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.