markovflow.models.gaussian_process_regression

Module containing a model for GP regression.

Module Contents

class GaussianProcessRegression(input_data: Tuple[tf.Tensor, tf.Tensor], kernel: markovflow.kernels.SDEKernel, mean_function: Optional[markovflow.mean_function.MeanFunction] = None, chol_obs_covariance: Optional[gpflow.base.TensorType] = None)[source]

Bases: markovflow.models.models.MarkovFlowModel

Performs GP regression.

The key reference is Chapter 2 of:

Gaussian Processes for Machine Learning
Carl Edward Rasmussen and Christopher K. I. Williams
The MIT Press, 2006. ISBN 0-262-18253-X.

This class uses the kernel and the time points to create a state space model. GP regression is then a Kalman filter on that state space model using the observations.

Parameters
  • kernel – A kernel defining a prior over functions.

  • input_data – A tuple of (time_points, observations) containing the observed data: time points of observations, with shape batch_shape + [num_data], observations with shape batch_shape + [num_data, observation_dim].

  • chol_obs_covariance – A TensorType containing the Cholesky factor of the observation noise covariance, with shape [observation_dim, observation_dim]. a default None value will assume independent likelihood variance of 1.0

  • mean_function – The mean function for the GP. Defaults to no mean function.

property time_pointstf.Tensor[source]

Return the time points of observations.

Returns

A tensor with shape batch_shape + [num_data].

property observationstf.Tensor[source]

Return the observations.

Returns

A tensor with shape batch_shape + [num_data, observation_dim].

property kernelmarkovflow.kernels.SDEKernel[source]

Return the kernel of the GP.

property mean_functionmarkovflow.mean_function.MeanFunction[source]

Return the mean function of the GP.

loss()tf.Tensor[source]

Return the loss, which is the negative log likelihood.

property posteriormarkovflow.posterior.PosteriorProcess[source]

Obtain a posterior process for inference.

For this class, this is the AnalyticPosteriorProcess built from the Kalman filter.

log_likelihood()tf.Tensor[source]

Calculate the log likelihood of the observations given the kernel parameters.

In other words, \(log p(y_{1...T} | ϑ)\) for some parameters \(ϑ\).

Returns

A scalar tensor (summed over the batch shape and the whole trajectory).