A prior over functions
The topic Gibbs sampling and Metropolis–Hastings finished our toolkit for posteriors over parameters. But every model so far had a parameter vector of a fixed size, chosen before seeing the data. In regression this is often the wrong thing to be uncertain about. In Bayesian linear regression the weights were only a means to an end: what we predicted was the function , and the prior on mattered only through the uncertainty it induced on .
So let us put the prior on the function directly. A function is an infinite-dimensional object, one value for each input. We cannot write a density over all of them, but we never need to: we only ever look at finitely many values.
Definition. A Gaussian process is a random function such that for any finite set of inputs the values are jointly Gaussian:
We write . The mean function is the prior guess; the kernel, or covariance function, says how strongly the values at two inputs move together. Throughout this topic : before the data, the function is as likely to go up as down.
To "draw a function" from the prior, pick a fine grid of, say, 200 inputs, build the matrix and sample one vector from : draw and take , where . Plotted against the grid, it looks like a curve.
A Gaussian process is nonparametric: there is no fixed list of parameters. As we will see, the prediction uses one coefficient per training point, so the model grows with the data.