Before you readYou have measured the temperature at a few stops along a road. Where would you be least sure of your prediction between stops?
Watch: Easy introduction to Gaussian process regression · paretos
A Gaussian process (GP) is a distribution over functions in which any finite set of values f(x1),…,f(xn) is jointly Gaussian. A mean function gives their expected values, and a kernelk(x,x′) gives their covariance. The kernel must give a positive semi-definite covariance matrix for every set of inputs.
Take a zero mean and the squared-exponential kernel (also called the RBF kernel):
k(x,x′)=exp(−2ℓ2(x−x′)2).
Here k(x,x)=1: every input has prior variance one. The length scale ℓ controls how far apart two inputs can be before their values stop moving together. Shorter length scales allow faster changes in a draw from the prior.
Condition on data
As in Bayesian linear regression, each observation is yi=f(xi)+εi with independent Gaussian noise of variance σn2. Let K be the matrix with entries Kij=k(xi,xj), and let k∗ be the column with entries k(xi,x∗) for a new input x∗. The noisy observations have covariance A=K+σn2I. Conditioning the joint Gaussian on the observed values y gives
μ∗s∗2=k∗TA−1y,=k(x∗,x∗)−k∗TA−1k∗.
The mean is a weighted sum of the observations. The variance starts at the prior variance and subtracts what the data tell us. Notice that only the mean uses the observed heights y; with the kernel and noise fixed, the variance depends on where you measured, not on what you measured.
Posterior mean and pointwise 95% band. Length scale 1.1. Middle dot at x -0.4. The 95% band is 1.13 units wide there.The solid curve is the posterior mean; the shaded region is the pointwise 95% band. Drag the middle dot or move its slider. What happens to the band where the dot used to be?
Far from the observations, the RBF covariances in k∗ tend to zero: the mean returns to zero and the variance returns to one. The band shows uncertainty about the functionf(x∗). For a new noisy observation, add σn2 to s∗2.
Recall
What does a shorter RBF length scale change?
Recall
If you change only the observed heights, can the GP posterior variance change?
Exercise
You observe one value y=4. At a new input, k(x∗,x∗)=1 and k(x1,x∗)=21. If k(x1,x1)=1 and the noise variance is 1, find the posterior mean and variance of f(x∗), in that order.
Exercise
A GP has two noiseless observations with K=[121211]. At a new input x∗,k∗=(21,21)T and k(x∗,x∗)=1. Find the posterior variance of f(x∗).