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 dense gpjax.gps.ConjugateModel 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