Quant Memo
Advanced

Gaussian Process Regression

A Gaussian process treats a regression curve as one draw from an infinite family of possible curves, and instead of predicting a single number it predicts a whole distribution — a best guess plus exactly how unsure it should be, widest where data is sparse.

Prerequisites: The Kernel Trick and Kernel Methods

Most regression models spit out one number per input and stay silent about how much to trust it. A model interpolating between two well-observed points and a model extrapolating far past the edge of its data can produce identical-looking point predictions while deserving wildly different confidence. Gaussian process regression is built to answer both questions at once: what's the best guess, and how sure should you be.

The analogy: a rope pinned at known points

Picture an infinitely flexible, slightly stiff rope draped so it must pass exactly through a handful of known data points — the observed prices, the known measurements. Between two pins close together, the rope has very little freedom; it's almost pinned down, so you can predict its height there with confidence. Far from any pin, out past the edge of the data, the rope could sag or rise almost anywhere, and your confidence collapses. A Gaussian process is the mathematical version of "every possible rope consistent with the pins," averaged and measured for spread at every point.

The maths: a distribution over functions

A Gaussian process is defined by a mean function (usually taken as zero, for simplicity) and a covariance function k(x,x)k(x, x') that says how correlated the curve's height is at two input points xx and xx':

fGP(0,k(x,x))f \sim \mathcal{GP}\big(0, \, k(x, x')\big)

In words: instead of picking one curve, we describe an entire cloud of plausible curves, and kk controls how "wiggly" they're allowed to be — points close together in xx have highly correlated heights (the curve can't jump), points far apart are nearly independent. Given observed data, prediction at a new point xx_* produces a mean and a variance:

μ=kK1y,σ2=k(x,x)kK1k\mu_* = k_*^\top K^{-1} y, \qquad \sigma_*^2 = k(x_*,x_*) - k_*^\top K^{-1} k_*

Here yy is the vector of observed outputs, KK is the matrix of covariances between all pairs of observed points, and kk_* is the vector of covariances between the new point and each observed point. In words: the predicted mean μ\mu_* is a weighted blend of the observed values, weighted by how correlated they are with the new point; the predicted variance σ2\sigma_*^2 starts at the curve's natural variance and shrinks by however much the observed data pins it down. Far from any data, kk_* is near zero, nothing shrinks the variance, and the model correctly reports "I don't know."

Worked example 1: two points, predict the middle

Suppose we've observed y=10y=10 at x=0x=0 and y=14y=14 at x=2x=2, using an RBF-style covariance where nearby points correlate strongly. Predicting at x=1x=1, exactly halfway, symmetry makes both training points equally relevant, so the predicted mean is close to their average: μ12\mu_* \approx 12. The predicted variance at x=1x=1 is small, because x=1x=1 sits between two observations that strongly constrain it — the rope can barely move there.

Worked example 2: extrapolation blows up the uncertainty

Same two points, but now predict at x=10x=10, far outside the observed range [0,2][0,2]. With an RBF covariance, correlation decays fast with distance, so kk_* for both training points is now nearly zero — neither observation says much about x=10x=10. The predicted mean drifts back toward the prior mean (often zero, or flat), and critically the predicted variance σ2\sigma_*^2 grows back up toward k(x,x)k(x_*,x_*), its unconstrained value. Concretely, if the interpolated variance at x=1x=1 was, say, 0.30.3, the extrapolated variance at x=10x=10 might be 10×10\times larger — the model is explicitly telling you "trust this prediction far less."

Convergence explorer
true meansamples →
after n = 200estimate -0.025error 0.025std error 0.071

Watch how an estimate narrows as more data accumulates in the explorer above — a Gaussian process does the same thing locally: its uncertainty band narrows wherever observations cluster and stays wide everywhere else.

Function explorer
-2260.1
x = 1.00f(x) = 2.718

The RBF covariance's exponential decay with distance (shown in shape here) is exactly what controls how fast a Gaussian process's confidence collapses as you move away from a data point.

A Gaussian process predicts a mean and a variance at every point, and the variance is small near observed data and large far from it — uncertainty is not an afterthought, it's built into the output.

What this means in practice

Gaussian processes are prized wherever knowing "how confident should I be" matters as much as the point estimate itself: pricing illiquid instruments by interpolating from nearby liquid ones, Bayesian optimisation of trading-strategy hyperparameters, or building a smooth, uncertainty-aware yield curve from sparse market quotes. The catch is cost — the K1K^{-1} in the formulas above is a matrix inversion that scales roughly with the cube of the number of data points, which makes vanilla Gaussian processes impractical much past a few thousand observations without approximations.

The classic trap is trusting a Gaussian process's confidence intervals blindly without checking the covariance function matches the data's real smoothness. An RBF kernel assumes an infinitely smooth underlying function; feed it data with sharp jumps (an earnings announcement, a regime change) and it will confidently underestimate uncertainty right where you need it most, because the model structurally cannot imagine a discontinuity.

Related concepts

Practice in interviews

Further reading

  • Rasmussen & Williams, Gaussian Processes for Machine Learning, ch. 2
  • Murphy, Machine Learning: A Probabilistic Perspective, ch. 15
ShareTwitterLinkedIn