Gaussian process regression (GPR) models are nonparametric kernel-based
probabilistic models. You can train a GPR model using the fitrgp
function.
Consider the training set , where and , drawn from an unknown distribution. A GPR model addresses the question of predicting the value of a response variable , given the new input vector , and the training data. A linear regression model is of the form
where . The error variance σ2 and the coefficients β are estimated from the data. A GPR model explains the response by introducing latent variables, , from a Gaussian process (GP), and explicit basis functions, h. The covariance function of the latent variables captures the smoothness of the response and basis functions project the inputs into a p-dimensional feature space.
A GP is a set of random variables, such that any finite number of them have a joint Gaussian distribution. If is a GP, then given n observations , the joint distribution of the random variables is Gaussian. A GP is defined by its mean function and covariance function, . That is, if is a Gaussian process, then and
Now consider the following model.
where , that is f(x) are from a zero mean GP with covariance function, . h(x) are a set of basis functions that transform the original feature vector x in Rd into a new feature vector h(x) in Rp. β is a p-by-1 vector of basis function coefficients. This model represents a GPR model. An instance of response y can be modeled as
Hence, a GPR model is a probabilistic model. There is a latent variable f(xi) introduced for each observation , which makes the GPR model nonparametric. In vector form, this model is equivalent to
where
The joint distribution of latent variables in the GPR model is as follows:
close to a linear regression model, where looks as follows:
The covariance function is usually parameterized by a set of kernel parameters or hyperparameters, . Often is written as to explicitly indicate the dependence on .
fitrgp
estimates the basis
function coefficients, ,
the noise variance, ,
and the hyperparameters,,
of the kernel function from the data while training the GPR model.
You can specify the basis function, the kernel (covariance) function,
and the initial values for the parameters.
Because a GPR model is probabilistic, it is possible to compute
the prediction intervals using the trained model (see predict
and resubPredict
).
Consider some data observed from the function g(x)
= x*sin(x), and assume that
they are noise free. The subplot on the left in the following figure
illustrates the observations, the GPR fit, and the actual function.
It is more realistic that the observed values are not the exact function
values, but a noisy realization of them. The subplot on the right
illustrates this case. When observations are noise free (as in the
subplot on the left), the GPR fit crosses the observations, and the
standard deviation of the predicted response is zero. Hence, you do
not see prediction intervals around these values.
You can also compute the regression error using the trained
GPR model (see loss
and resubLoss
).
[1] Rasmussen, C. E. and C. K. I. Williams. Gaussian Processes for Machine Learning. MIT Press. Cambridge, Massachusetts, 2006.