Likelihoods
AbstractLikelihood
Bases: Module
Abstract base class for likelihoods.
All likelihoods must inherit from this class and implement the predict and
link_function methods.
Parameters:
-
num_datapoints(int) βthe number of data points.
-
integrator(AbstractIntegrator, default:GHQuadratureIntegrator()) βThe integrator to be used for computing expected log likelihoods. Must be an instance of
AbstractIntegrator.
__call__
Evaluate the likelihood function at a given predictive distribution.
Parameters:
-
dist(Union[MultivariateNormal, GaussianDistribution]) βThe predictive distribution to evaluate the likelihood at.
Returns:
-
DistributionβThe predictive distribution.
predict
abstractmethod
Evaluate the likelihood function at a given predictive distribution.
Parameters:
-
dist(Union[MultivariateNormal, GaussianDistribution]) βThe predictive distribution to evaluate the likelihood at.
Returns:
-
Distributionβnpd.Distribution: The predictive distribution.
link_function
abstractmethod
Return the link function of the likelihood function.
Parameters:
-
f(Float[Array, '...']) βthe latent Gaussian process values.
Returns:
-
Distributionβnpd.Distribution: The distribution of observations, y, given values of the Gaussian process, f.
expected_log_likelihood
Compute the expected log likelihood.
For a variational distribution \(q(f)\sim\mathcal{N}(m, s)\) and a likelihood \(p(y|f)\), compute the expected log likelihood:
Parameters:
-
y(Float[Array, 'N D']) βThe observed response variable.
-
mean(Float[Array, 'N D']) βThe variational mean.
-
variance(Float[Array, 'N D']) βThe variational variance.
-
mean_g(Float[Array, 'N D'], default:None) βOptional moments of the latent noise process for heteroscedastic likelihoods.
-
variance_g(Float[Array, 'N D'], default:None) βOptional moments of the latent noise process for heteroscedastic likelihoods.
-
**_(Any, default:{}) βUnused extra arguments for compatibility with specialised likelihoods.
Returns:
-
ScalarFloat(Float[Array, ' N']) βThe expected log likelihood.
AbstractNoiseTransform
LogNormalTransform
SoftplusTransform
AbstractHeteroscedasticLikelihood
AbstractHeteroscedasticLikelihood(
num_datapoints,
noise_prior,
noise_transform=SoftplusTransform(),
integrator=GHQuadratureIntegrator(),
)
Bases: AbstractLikelihood
Base class for heteroscedastic likelihoods with latent noise processes.
predict
abstractmethod
Evaluate the likelihood function at a given predictive distribution.
Parameters:
-
dist(Union[MultivariateNormal, GaussianDistribution]) βThe predictive distribution to evaluate the likelihood at.
Returns:
-
Distributionβnpd.Distribution: The predictive distribution.
link_function
abstractmethod
Return the link function of the likelihood function.
Parameters:
-
f(Float[Array, '...']) βthe latent Gaussian process values.
Returns:
-
Distributionβnpd.Distribution: The distribution of observations, y, given values of the Gaussian process, f.
supports_tight_bound
Return whether the tighter bound from LΓ‘zaro-Gredilla & Titsias (2011) is applicable.
noise_statistics
Moment matching of the transformed noise process.
Parameters:
-
mean(Float[Array, 'N D']) βMean of the latent noise GP.
-
variance(Float[Array, 'N D']) βVariance of the latent noise GP.
Returns:
-
NoiseMoments(NoiseMoments) βExpected log variance, inverse variance, and variance.
Gaussian
Bases: AbstractLikelihood
Gaussian likelihood object.
Parameters:
-
num_datapoints(int) βthe number of data points.
-
obs_stddev(Union[ScalarFloat, Float[Array, '#N']], default:1.0) βthe standard deviation of the Gaussian observation noise.
-
integrator(AbstractIntegrator, default:AnalyticalGaussianIntegrator()) βThe integrator to be used for computing expected log likelihoods. Must be an instance of
AbstractIntegrator. For the Gaussian likelihood, this defaults to theAnalyticalGaussianIntegrator, as the expected log likelihood can be computed analytically.
__call__
Evaluate the likelihood function at a given predictive distribution.
Parameters:
-
dist(Union[MultivariateNormal, GaussianDistribution]) βThe predictive distribution to evaluate the likelihood at.
Returns:
-
DistributionβThe predictive distribution.
expected_log_likelihood
Compute the expected log likelihood.
For a variational distribution \(q(f)\sim\mathcal{N}(m, s)\) and a likelihood \(p(y|f)\), compute the expected log likelihood:
Parameters:
-
y(Float[Array, 'N D']) βThe observed response variable.
-
mean(Float[Array, 'N D']) βThe variational mean.
-
variance(Float[Array, 'N D']) βThe variational variance.
-
mean_g(Float[Array, 'N D'], default:None) βOptional moments of the latent noise process for heteroscedastic likelihoods.
-
variance_g(Float[Array, 'N D'], default:None) βOptional moments of the latent noise process for heteroscedastic likelihoods.
-
**_(Any, default:{}) βUnused extra arguments for compatibility with specialised likelihoods.
Returns:
-
ScalarFloat(Float[Array, ' N']) βThe expected log likelihood.
link_function
The link function of the Gaussian likelihood.
Parameters:
-
f(Float[Array, '...']) βFunction values.
Returns:
-
Normalβnpd.Normal: The likelihood function.
predict
Evaluate the Gaussian likelihood.
Evaluate the Gaussian likelihood function at a given predictive distribution. Computationally, this is equivalent to summing the observation noise term to the diagonal elements of the predictive distribution's covariance matrix.
Parameters:
-
dist(Distribution) βThe Gaussian process posterior, evaluated at a finite set of test points.
Returns:
-
MultivariateNormalβnpd.Distribution: The predictive distribution.
Bernoulli
Bases: AbstractLikelihood
Parameters:
-
num_datapoints(int) βthe number of data points.
-
integrator(AbstractIntegrator, default:GHQuadratureIntegrator()) βThe integrator to be used for computing expected log likelihoods. Must be an instance of
AbstractIntegrator.
__call__
Evaluate the likelihood function at a given predictive distribution.
Parameters:
-
dist(Union[MultivariateNormal, GaussianDistribution]) βThe predictive distribution to evaluate the likelihood at.
Returns:
-
DistributionβThe predictive distribution.
expected_log_likelihood
Compute the expected log likelihood.
For a variational distribution \(q(f)\sim\mathcal{N}(m, s)\) and a likelihood \(p(y|f)\), compute the expected log likelihood:
Parameters:
-
y(Float[Array, 'N D']) βThe observed response variable.
-
mean(Float[Array, 'N D']) βThe variational mean.
-
variance(Float[Array, 'N D']) βThe variational variance.
-
mean_g(Float[Array, 'N D'], default:None) βOptional moments of the latent noise process for heteroscedastic likelihoods.
-
variance_g(Float[Array, 'N D'], default:None) βOptional moments of the latent noise process for heteroscedastic likelihoods.
-
**_(Any, default:{}) βUnused extra arguments for compatibility with specialised likelihoods.
Returns:
-
ScalarFloat(Float[Array, ' N']) βThe expected log likelihood.
link_function
The probit link function of the Bernoulli likelihood.
Parameters:
-
f(Float[Array, '...']) βFunction values.
Returns:
-
BernoulliProbsβnpd.Bernoulli: The likelihood function.
predict
Evaluate the pointwise predictive distribution.
Evaluate the pointwise predictive distribution, given a Gaussian process posterior and likelihood parameters.
Parameters:
-
dist([npd.MultivariateNormal, GaussianDistribution].) βThe Gaussian process posterior, evaluated at a finite set of test points.
Returns:
-
BernoulliProbsβnpd.Bernoulli: The pointwise predictive distribution.
Poisson
Bases: AbstractLikelihood
Parameters:
-
num_datapoints(int) βthe number of data points.
-
integrator(AbstractIntegrator, default:GHQuadratureIntegrator()) βThe integrator to be used for computing expected log likelihoods. Must be an instance of
AbstractIntegrator.
__call__
Evaluate the likelihood function at a given predictive distribution.
Parameters:
-
dist(Union[MultivariateNormal, GaussianDistribution]) βThe predictive distribution to evaluate the likelihood at.
Returns:
-
DistributionβThe predictive distribution.
expected_log_likelihood
Compute the expected log likelihood.
For a variational distribution \(q(f)\sim\mathcal{N}(m, s)\) and a likelihood \(p(y|f)\), compute the expected log likelihood:
Parameters:
-
y(Float[Array, 'N D']) βThe observed response variable.
-
mean(Float[Array, 'N D']) βThe variational mean.
-
variance(Float[Array, 'N D']) βThe variational variance.
-
mean_g(Float[Array, 'N D'], default:None) βOptional moments of the latent noise process for heteroscedastic likelihoods.
-
variance_g(Float[Array, 'N D'], default:None) βOptional moments of the latent noise process for heteroscedastic likelihoods.
-
**_(Any, default:{}) βUnused extra arguments for compatibility with specialised likelihoods.
Returns:
-
ScalarFloat(Float[Array, ' N']) βThe expected log likelihood.
link_function
The link function of the Poisson likelihood.
Parameters:
-
f(Float[Array, '...']) βFunction values.
Returns:
-
Poissonβnpd.Poisson: The likelihood function.
predict
Evaluate the pointwise predictive distribution.
Evaluate the pointwise predictive distribution, given a Gaussian process posterior and likelihood parameters.
Parameters:
-
dist(Union[MultivariateNormal, GaussianDistribution]) βThe Gaussian process posterior, evaluated at a finite set of test points.
Returns:
-
Poissonβnpd.Poisson: The pointwise predictive distribution.