NonConjugatePosterior#

class gpjax.gps.NonConjugatePosterior(prior, likelihood, latent=None, jitter=1e-06, key=Array((), dtype=key<fry>) overlaying: [ 0 42])[source]#

Bases: AbstractPosterior[P, NGL]

A non-conjugate Gaussian process posterior object.

A Gaussian process posterior object for models where the likelihood is non-Gaussian. Unlike the ConjugatePosterior object, the NonConjugatePosterior object does not provide an exact marginal log-likelihood function. Instead, the NonConjugatePosterior object represents the posterior distributions as a function of the model’s hyperparameters and the latent function. Markov chain Monte Carlo, variational inference, or Laplace approximations can then be used to sample from, or optimise an approximation to, the posterior distribution.

Parameters:
  • prior (AbstractPrior)

  • likelihood (Any)

  • latent (Any)

  • jitter (float)

  • key (UInt32[jaxlib._jax.Array, '2'] | Key[jaxlib._jax.Array, ''])

predict(test_inputs, train_data, *, return_covariance_type='dense')[source]#

Query the predictive posterior distribution.

Conditional on a set of training data, compute the GP’s posterior predictive distribution for a given set of parameters. The returned function can be evaluated at a set of test inputs to compute the corresponding predictive density. Note, to gain predictions on the scale of the original data, the returned distribution will need to be transformed through the likelihood function’s inverse link function.

Parameters:
  • test_inputs (Num[Array, "N D"]) – A Jax array of test inputs at which the predictive distribution is evaluated.

  • train_data (Dataset) – A gpx.Dataset object that contains the input and output data used for training dataset.

  • return_covariance_type (Literal['dense', 'diagonal']) – 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 function that accepts an

input array and returns the predictive distribution as a dx.Distribution.

Return type:

GaussianDistribution