gpflux.sampling.utils#

This module contains utilities for sampling from multivariate Gaussian distributions.

Module Contents#

_cholesky_with_jitter(cov: gpflow.base.TensorType) tf.Tensor[source]#

Compute the Cholesky of the covariance, adding jitter (determined by gpflow.default_jitter()) to the diagonal to improve stability.

Parameters:

cov – full covariance with shape [..., N, D, D].

draw_conditional_sample(mean: gpflow.base.TensorType, cov: gpflow.base.TensorType, f_old: gpflow.base.TensorType) tf.Tensor[source]#

Draw a sample f~new from the conditional multivariate Gaussian p(fnew|fold), where the parameters mean and cov are the mean and covariance matrix of the joint multivariate Gaussian over [fold,fnew].

Parameters:
  • mean

    A tensor with the shape [..., D, N+M] with the mean of [f_old, f_new]. For each [..., D] this is a stacked vector of the form:

    (mean(fold)[N]mean(fnew)[M])

  • cov

    A tensor with the shape [..., D, N+M, N+M] with the covariance of [f_old, f_new]. For each [..., D], there is a 2x2 block matrix of the form:

    (cov(fold,fold)[N,N]cov(fold,fnew)[N,M]cov(fnew,fold)[M,N]cov(fnew,fnew)[M,M])

  • f_old – A tensor of observations with the shape [..., D, N], drawn from Normal distribution with mean mean(fold)[N], and covariance cov(fold,fold)[N,N]

Returns:

A sample f~new from the conditional normal p(fnew|fold) with the shape [..., D, M].