Kernels for Gaussian Processes
A kernel is a symmetric positive semi-definite function that specifies the covariance structure of a Gaussian process: . Positive semi-definite means that for any finite collection of points , the Gram matrix is positive semi-definite. This is the only restriction: every valid kernel defines a valid GP.
The kernel encodes every prior belief about the function — smoothness, stationarity, length-scale, periodicity, boundary conditions. Canonical kernels on :
- Brownian motion: . Samples are continuous but nowhere differentiable; .
- Scaled BM plus constant: . Adds an intercept so ; with the intercept is flat.
- Integrated Brownian Motion (IBM): . Samples are once-differentiable; .
- Scaled IBM plus linear term: . Adds priors on intercept and slope; used in 3.10.2 GP Regression because its posterior mean is a natural cubic spline.
Canonical kernels on :
- Linear: . GP is the Bayesian linear-regression function.
- Squared-exponential (RBF): . Samples are infinitely differentiable; is the length-scale.
- Matérn: smoothness-tunable generalization of RBF. At half-integer smoothness parameters, has closed-form simple expressions.
Valid kernels form a cone under three operations: sums , products , and scalar multiples (for ). This kernel algebra allows building complex priors from simple parts.
Prerequisites
- 3.10 Gaussian Processes — parent index; the definition of a GP.
- 6.2 Multivariate Gaussian Distribution — what “positive semi-definite covariance” means.
- 4.6 Brownian Motion — the underlying stochastic process for most non-stationary kernels in this note.
Intuition
A kernel answers one question: if takes a value above its mean, how confident am I that does too? Large means the function values are tightly correlated; small means they are nearly independent. The kernel shape translates prior knowledge about the function into correlations between function values at pairs of inputs.
Three axes govern kernel design. Smoothness determines how many times sample paths can be differentiated: Brownian samples are continuous but not differentiable, IBM samples are once differentiable, RBF samples are . Stationarity determines whether depends only on the separation or on the absolute positions; stationary kernels (RBF, Matérn) treat the domain homogeneously, non-stationary kernels (Brownian, IBM) let the variance grow away from the origin. Boundary conditions fall out of the kernel: Brownian motion pins , IBM pins both and , and adding a linear term with flat priors on the coefficients releases these constraints.
The positive semi-definiteness requirement is not a technicality — it is the statement that every finite-dimensional marginal of the induced GP is a proper Gaussian. Violate it and the implied “distribution” assigns negative variance to some linear combination of function values, which is nonsense.
Properties
(Kernel Algebra) Sums, products, and nonneg. scalar multiples of valid kernels are valid kernels.
If and are positive semi-definite, so are , , and for . This is the operational fact that lets one build elaborate kernels from simple parts. Summing kernels yields additive GPs — with independent. Multiplying kernels combines effects, for example trend times periodic component. The scaled-IBM-plus-linear-term kernel is literally the sum of the “constant linear” kernel and the IBM kernel, reflecting the decomposition with independent components.
(Brownian Motion Kernel) Continuous non-differentiable samples; variance grows linearly.
The kernel is the covariance of standard Brownian motion on . It enforces almost surely (since ) and gives , so the variance grows linearly with . Positive semi-definiteness follows directly from the independent-increments representation: any linear combination rewrites as a linear combination of independent Gaussian increments. Sample paths are continuous but nowhere differentiable — a consequence of the square-root scaling of increments, , which has magnitude rather than . This makes Brownian motion a very rough prior, appropriate when the function is expected to fluctuate on every scale. See 3.10.3 Integrated Brownian Motion for a smoother alternative.
(Integrated Brownian Motion Kernel) Once-differentiable samples; cubic-spline posterior mean.
The IBM kernel is
It is obtained by integrating Brownian motion once: . Since the integral of a continuous path is differentiable, IBM samples are . The kernel pins and , so in practice one uses the scaled-IBM-plus-linear-term kernel to release these constraints. The headline property: with the scaled-IBM-plus-linear-term kernel, the posterior mean for the GP regression problem is the natural cubic spline interpolant — the same smoother produced by penalized-splines methods in frequentist nonparametric regression. Full details in 3.10.3 Integrated Brownian Motion.
(Squared-Exponential / RBF Kernel) Infinitely smooth stationary default.
The squared-exponential kernel
depends only on the Euclidean distance , so it is stationary and isotropic. Samples are infinitely differentiable — in fact analytic — which makes RBF the default kernel for smooth regression problems. The length-scale controls how rapidly correlations decay: small gives wiggly samples, large gives nearly-constant samples. The signal scale controls the overall variance. In high dimensions the RBF is often equipped with automatic relevance determination (ARD) weights, giving a separate length-scale per dimension: , which shrinks irrelevant dimensions to zero influence.
(Linear Kernel) GP with a linear kernel is Bayesian linear regression.
For , the induced GP is with . The covariance reproduces: . This collapses GP regression to 3.8.1 Bayesian Linear Regression with a standard-normal prior. The linear kernel is degenerate — only -dimensional, not infinite-dimensional — so its Gram matrices have rank at most . This observation generalizes: a kernel for any feature map is a linear kernel in -space, and the GP is .
(Non-Stationarity of BM/IBM Kernels) Variance depends on position, not just separation.
Brownian and Integrated Brownian kernels have and respectively — the variance grows with position, so the prior is non-stationary. This is usually undesirable when the domain is a bounded interval with no special “origin,” but it is exactly what is wanted when is a meaningful initial time and the function accumulates uncertainty as grows. For Bayesian nonparametric regression on a generic interval, shift-invariance is usually preferred and the RBF or Matérn kernel is the default choice. Non-stationary kernels shine in time-series settings where the origin is a real anchor.
(Mercer Decomposition) Every kernel has a spectral eigenfunction decomposition.
By Mercer’s theorem, a continuous positive semi-definite kernel on a compact domain admits
where is an orthonormal basis of eigenfunctions and . A GP with this kernel can be written as with . This connects GPs to Bayesian linear regression in an infinite-dimensional feature space and underlies the theoretical analysis of GP regression (effective degrees of freedom, rates of convergence). For the Brownian motion kernel on , the eigenfunctions are sines and the eigenvalues decay as . For the IBM kernel, eigenvalues decay as — faster decay reflects smoother samples.
(Hyperparameter Estimation) Kernel parameters are learned via marginal likelihood.
Kernels typically depend on free hyperparameters: length-scale , signal variance , ratio . These are estimated by maximizing (or placing priors on) the marginal likelihood . On a log scale, the marginal likelihood is
which has a built-in Occam penalty: the log-determinant term shrinks with overly flexible kernels. See 3.7 Marginal Likelihood for why this counts as automatic model selection.
Examples
(Easy) Verify positive semi-definiteness of the Brownian motion kernel.
Show that is positive semi-definite on .
Solution. Take any and coefficients . Set (with ), so and the are independent with . Then
The equality on the right uses independence of the . This confirms is positive semi-definite.
(Medium) Build a kernel with a periodic and trend component.
Suppose is believed to consist of a smooth long-term trend plus a periodic oscillation of period roughly 1. Construct a kernel.
Solution. Use the sum with
The trend component captures slow variation; the periodic component captures the one-unit cycle. Because valid kernels are closed under sums, is positive semi-definite. Fitting to data requires learning via marginal likelihood — see 3.10.2 GP Regression.
(Hard) GP with RBF kernel on one point recovers the Normal-Normal model.
Show that if , observing under a zero-mean GP with RBF kernel recovers the univariate 3.5.2 Normal-Normal Model for .
Solution. With , the Gram matrix is the scalar . The prior on is . Observing , the posterior is
This is exactly the Normal-Normal posterior for unknown mean with , , noise . The posterior mean shrinks toward the prior mean (zero) with weight . At a new test point , the prediction is , which interpolates between zero (far from ) and the shrunken observation (near ).
See Also
- 3.10 Gaussian Processes — parent index.
- 3.10.2 GP Regression — posterior formulas and hyperparameter estimation.
- 3.10.3 Integrated Brownian Motion — detailed treatment of the IBM kernel.
- 6.2 Multivariate Gaussian Distribution — conditioning formula that drives all posterior calculations.
- 4.6 Brownian Motion — underlying stochastic process for the canonical non-stationary kernels.