StateSpacePrior#

class gpjax.state_space.StateSpacePrior(kernel, mean_function, jitter=1e-06)[source]#

Bases: Prior

Prior for a state-space (Markovian) GP.

Predictions match gpjax.gps.Prior for both covariance modes. covariance="diagonal" (the default) uses the SDE’s stationary state covariance directly rather than routing through the kernel, since the prior is stationary in time; covariance="dense" returns the kernel’s own dense gram over the test inputs, since the state-space SDE is an exact representation of the kernel with no training data to marginalise out. Either way, this predictive is Liskov-substitutable for the dense gpjax.gps.Prior predictive.

Example

>>> import gpjax as gpx
>>> from gpjax.state_space import StateSpacePrior
>>> prior = StateSpacePrior(
...     mean_function=gpx.mean_functions.Zero(),
...     kernel=gpx.kernels.Matern32(lengthscale=1.0, variance=1.0),
... )
>>> isinstance(prior.kernel, gpx.kernels.Matern32)
True
Parameters:
  • kernel (K)

  • mean_function (M)

  • jitter (float)

predict(test_inputs, *, covariance='diagonal')[source]#

Compute the prior predictive distribution at the test inputs.

Example

>>> import gpjax as gpx
>>> import jax.numpy as jnp
>>> kernel = gpx.kernels.RBF()
>>> mean_function = gpx.mean_functions.Zero()
>>> prior = gpx.gps.Prior(mean_function=mean_function, kernel=kernel)
>>> prior.predict(jnp.linspace(0, 1, 100)[:, None])
Parameters:
  • test_inputs (Float[Array, "N D"]) – The inputs at which to evaluate the prior distribution.

  • covariance – Whether to return the dense joint covariance at the test inputs or only the marginal (diagonal) variances.

Returns:

A multivariate normal random variable

representation of the Gaussian process.

Return type:

GaussianDistribution