Variational Families
AbstractVariationalFamily
Bases: Module
, Generic[L]
Abstract base class used to represent families of distributions that can be used within variational inference.
__call__
Evaluate the variational family's density.
For a given set of parameters, compute the latent function's prediction under the variational approximation.
Parameters:
-
*args
(Any
, default:()
) –Arguments of the variational family's
predict
method. -
**kwargs
(Any
, default:{}
) –Keyword arguments of the variational family's
predict
method.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The output of the variational family's
predict
method.
predict
abstractmethod
Predict the GP's output given the input.
Parameters:
-
*args
(Any
, default:()
) –Arguments of the variational family's
predict
method. -
**kwargs
(Any
, default:{}
) –Keyword arguments of the variational family's
predict
method.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The output of the variational family's
predict
method.
AbstractVariationalGaussian
Bases: AbstractVariationalFamily[L]
The variational Gaussian family of probability distributions.
__call__
Evaluate the variational family's density.
For a given set of parameters, compute the latent function's prediction under the variational approximation.
Parameters:
-
*args
(Any
, default:()
) –Arguments of the variational family's
predict
method. -
**kwargs
(Any
, default:{}
) –Keyword arguments of the variational family's
predict
method.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The output of the variational family's
predict
method.
predict
abstractmethod
Predict the GP's output given the input.
Parameters:
-
*args
(Any
, default:()
) –Arguments of the variational family's
predict
method. -
**kwargs
(Any
, default:{}
) –Keyword arguments of the variational family's
predict
method.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The output of the variational family's
predict
method.
VariationalGaussian
VariationalGaussian(posterior, inducing_inputs, variational_mean=None, variational_root_covariance=None, jitter=1e-06)
Bases: AbstractVariationalGaussian[L]
The variational Gaussian family of probability distributions.
The variational family is , where are the function values at the inducing inputs and the distribution over the inducing inputs is . We parameterise this over and with .
__call__
Evaluate the variational family's density.
For a given set of parameters, compute the latent function's prediction under the variational approximation.
Parameters:
-
*args
(Any
, default:()
) –Arguments of the variational family's
predict
method. -
**kwargs
(Any
, default:{}
) –Keyword arguments of the variational family's
predict
method.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The output of the variational family's
predict
method.
prior_kl
Compute the prior KL divergence.
Compute the KL-divergence between our variational approximation and the Gaussian process prior.
For this variational family, we have
where and are the inducing inputs.
Returns:
-
ScalarFloat
(ScalarFloat
) –The KL-divergence between our variational approximation and the GP prior.
predict
Compute the predictive distribution of the GP at the test inputs t.
This is the integral , which can be computed in closed form as:
Parameters:
-
test_inputs
(Float[Array, 'N D']
) –The test inputs at which we wish to make a prediction.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The predictive distribution of the low-rank GP at the test inputs.
WhitenedVariationalGaussian
WhitenedVariationalGaussian(posterior, inducing_inputs, variational_mean=None, variational_root_covariance=None, jitter=1e-06)
Bases: VariationalGaussian[L]
The whitened variational Gaussian family of probability distributions.
The variational family is , where are the function values at the inducing inputs and the distribution over the inducing inputs is . We parameterise this over and with .
__call__
Evaluate the variational family's density.
For a given set of parameters, compute the latent function's prediction under the variational approximation.
Parameters:
-
*args
(Any
, default:()
) –Arguments of the variational family's
predict
method. -
**kwargs
(Any
, default:{}
) –Keyword arguments of the variational family's
predict
method.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The output of the variational family's
predict
method.
prior_kl
Compute the KL-divergence between our variational approximation and the Gaussian process prior.
For this variational family, we have
Returns:
-
ScalarFloat
(ScalarFloat
) –The KL-divergence between our variational approximation and the GP prior.
predict
Compute the predictive distribution of the GP at the test inputs t.
This is the integral q(f(t)) = \int p(f(t)\midu) q(u) du, which can be computed in closed form as
Parameters:
-
test_inputs
(Float[Array, 'N D']
) –The test inputs at which we wish to make a prediction.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The predictive distribution of the low-rank GP at the test inputs.
NaturalVariationalGaussian
NaturalVariationalGaussian(posterior, inducing_inputs, natural_vector=None, natural_matrix=None, jitter=1e-06)
Bases: AbstractVariationalGaussian[L]
The natural variational Gaussian family of probability distributions.
The variational family is , where are the function values at the inducing inputs and the distribution over the inducing inputs is . Expressing the variational distribution, in the form of the exponential family, , gives rise to the natural parameterisation , to perform model inference, where are the sufficient statistics.
__call__
Evaluate the variational family's density.
For a given set of parameters, compute the latent function's prediction under the variational approximation.
Parameters:
-
*args
(Any
, default:()
) –Arguments of the variational family's
predict
method. -
**kwargs
(Any
, default:{}
) –Keyword arguments of the variational family's
predict
method.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The output of the variational family's
predict
method.
prior_kl
Compute the KL-divergence between our current variational approximation and the Gaussian process prior.
For this variational family, we have
with and computed from the natural parameterisation .
Returns:
-
ScalarFloat
(ScalarFloat
) –The KL-divergence between our variational approximation and the GP prior.
predict
Compute the predictive distribution of the GP at the test inputs .
This is the integral , which can be computed in closed form as
with and computed from the natural parameterisation .
Returns:
-
GaussianDistribution
(GaussianDistribution
) –A function that accepts a set of test points and will return the predictive distribution at those points.
ExpectationVariationalGaussian
ExpectationVariationalGaussian(posterior, inducing_inputs, expectation_vector=None, expectation_matrix=None, jitter=1e-06)
Bases: AbstractVariationalGaussian[L]
The natural variational Gaussian family of probability distributions.
The variational family is , where are the function values at the inducing inputs and the distribution over the inducing inputs is . Expressing the variational distribution, in the form of the exponential family, , gives rise to the natural parameterisation and sufficient statistics . The expectation parameters are given by . This gives a parameterisation, to perform model inference over.
__call__
Evaluate the variational family's density.
For a given set of parameters, compute the latent function's prediction under the variational approximation.
Parameters:
-
*args
(Any
, default:()
) –Arguments of the variational family's
predict
method. -
**kwargs
(Any
, default:{}
) –Keyword arguments of the variational family's
predict
method.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The output of the variational family's
predict
method.
prior_kl
Evaluate the prior KL-divergence.
Compute the KL-divergence between our current variational approximation and the Gaussian process prior.
For this variational family, we have
where and are the expectation parameters of the variational distribution and and are the mean and covariance of the prior distribution.
Returns:
-
ScalarFloat
(ScalarFloat
) –The KL-divergence between our variational approximation and the GP prior.
predict
Evaluate the predictive distribution.
Compute the predictive distribution of the GP at the test inputs .
This is the integral , which can be computed in closed form as which can be computed in closed form as
with and computed from the expectation parameterisation .
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The predictive distribution of the GP at the test inputs .
CollapsedVariationalGaussian
Bases: AbstractVariationalGaussian[GL]
Collapsed variational Gaussian.
Collapsed variational Gaussian family of probability distributions. The key reference is Titsias, (2009) - Variational Learning of Inducing Variables in Sparse Gaussian Processes.
__call__
Evaluate the variational family's density.
For a given set of parameters, compute the latent function's prediction under the variational approximation.
Parameters:
-
*args
(Any
, default:()
) –Arguments of the variational family's
predict
method. -
**kwargs
(Any
, default:{}
) –Keyword arguments of the variational family's
predict
method.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The output of the variational family's
predict
method.
predict
Compute the predictive distribution of the GP at the test inputs.
Parameters:
-
test_inputs
(Float[Array, 'N D']
) –The test inputs at which to make predictions.
-
train_data
(Dataset
) –The training data that was used to fit the GP.
Returns:
-
GaussianDistribution
(GaussianDistribution
) –The predictive distribution of the collapsed variational Gaussian process at the test inputs .