Introduction to GP Regression

Definition of Gaussian Process

A Gaussian Process (GP) is a collection of random variables, any finite number of which have a joint Gaussian distribution. It is completely specified by its mean function $μ(x)$ and covariance function $k(x,x’)$, also known as the kernel function.

Where:

  • $μ(x) = E[f(x)]$ is the mean function
  • $k(x,x’) = E[(f(x) - μ(x))(f(x’) - μ(x’))]$ is the covariance function

For a random process, we usually introduce a time series to interpret the meaning of different states (e.g., a Poisson Process, which is a counting process dependent on time). However, a more formal way to understand processes is to define them on a space. For instance, time steps are performed in $Z$ space, and consequently, the GP is a type of process defined on $R^d$.

Every point in $R^d$ represents a state corresponding to a unique Normal Distribution. The key rule for this space is that when we combine all these states, their joint distribution forms a Multivariate Normal Distribution with a unique covariance function $K: R^d \rightarrow R \times R$

Background

Unlike Machine Learning Problem, once we have the dataset with vector $\mathbf{x}$ and target variable $y$, we do not need to split the dataset since the model assumption indicts the difference between training data and prediction data, following by the distribution:

Note:

Prior and Posterior distribution

For the convenience of illustration, the prior distribution is commonly set up by:

The next step is to find the posterior distribution of $y^ | x, y, x^$, we consider the general form:

Since we known that the division of Normal Distribution is also Normal, and the dominator is constant since the data is given, we analysis $\mathcal{N}(\boldsymbol{\mu}, \Sigma)$ directly.

Let $\delta \mathbf{a} := \mathbf{a} - \boldsymbol{\mu}_a,\quad \delta \mathbf{b} := \mathbf{b} - \boldsymbol{\mu}_b$ and we have:

Given that for block matrix, we have:

We define:

and complete the square:

which means:

Given with the data, now we obtain the posterior distribution for the predictive points.

Optimization

Our key is to find the correct kernel expression, we can introduce marginal likelihood function and try to find the maximum value of it. We start from the definition:

We consider f mentioned in the integral is the arbitrary expectation in $R^n$ space. so that $p(y|f)$ can be interpret as: under such expectation, how likely will the true observation happens, which is a normal distribution as the model assumption, and the term $p(f|X)$ means the prior behavior of $f$, depending on how we define the prior distribution. In this case, it is $\mathcal{N}(\mathbf{\mu}, K)$ and $\mathbf{\mu} = \mathbf{0}$ .

Since both distribution is Normal, the convolution of 2 normal distribution is still Normal. We have

We use the Negative Log Marginal Likelihood (NLML) as the objective function to optimize model hyperparameters because it provides a principled and probabilistic way to learn the best settings for the kernel (e.g., length-scales, variances) and noise level.

And

with $\mathbf{K}_y = \mathbf{K}_\theta + \sigma_n^2 \mathbf{I}$. Notice that NLML is gradient based therefore we can use GD, Adam and other common methods to solve the minimum solution.

Workflow

  1. Data process and initial part:
    1. Data Cleaning and Normalize
    2. Define the kernel function and initial the parameters to be optimized
    3. Define NLML
  2. Training Loop in given epochs number
    1. Calculate the NLML under current parameters
    2. Use Gradient-based Method with a learning rate
    3. Update the parameters
  3. After Training
    1. Calculate the posterior distribution and sample the result
    2. Present the result and Validation