StateSpacePrior#

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

Bases: Prior

Prior for a state-space (Markovian) GP.

Identical to gpjax.gps.Prior except predictions are diagonal-only (the prior is stationary in time, so off-diagonal covariance carries no extra information for v1’s diagonal-only predictive contract).

Predictive contract (v1): prediction returns diagonal (marginal) covariance only; the marginals are exact. A dense joint predictive is not implemented in v1 and is tracked as a follow-up. This predictive is therefore not Liskov-substitutable for a dense gpjax.gps.ConjugatePosterior 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, *, return_covariance_type='diagonal')[source]#

Compute the predictive prior distribution for a given set of parameters. The output of this function is a GaussianDistribution for a given set of inputs.

In the following example, we compute the predictive prior distribution and then evaluate it on the interval \([0, 1]\):

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.

  • return_covariance_type – Literal denoting whether to return the full covariance of the joint predictive distribution at the test_inputs (dense) or just the the standard-deviation of the predictive distribution at the test_inputs.

Returns:

A multivariate normal random variable representation

of the Gaussian process.

Return type:

GaussianDistribution