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:
-
*args
(Any
, default:()
) βArguments to be passed to the likelihood's
predict
method. -
**kwargs
(Any
, default:{}
) βKeyword arguments to be passed to the likelihood's
predict
method.
Returns:
-
Distribution
βThe predictive distribution.
predict
abstractmethod
Evaluate the likelihood function at a given predictive distribution.
Parameters:
-
*args
(Any
, default:()
) βArguments to be passed to the likelihood's
predict
method. -
**kwargs
(Any
, default:{}
) βKeyword arguments to be passed to the likelihood's
predict
method.
Returns:
-
Distribution
βtfd.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
βtfd.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.
Returns:
-
ScalarFloat
(Float[Array, ' N']
) βThe expected log likelihood.
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:
-
*args
(Any
, default:()
) βArguments to be passed to the likelihood's
predict
method. -
**kwargs
(Any
, default:{}
) βKeyword arguments to be passed to the likelihood's
predict
method.
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.
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
βtfd.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:
-
MultivariateNormalFullCovariance
βtfd.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:
-
*args
(Any
, default:()
) βArguments to be passed to the likelihood's
predict
method. -
**kwargs
(Any
, default:{}
) βKeyword arguments to be passed to the likelihood's
predict
method.
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.
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:
-
Distribution
βtfd.Distribution: The likelihood function.
predict
Evaluate the pointwise predictive distribution.
Evaluate the pointwise predictive distribution, given a Gaussian process posterior and likelihood parameters.
Parameters:
-
dist
(Distribution
) βThe Gaussian process posterior, evaluated at a finite set of test points.
Returns:
-
Distribution
βtfd.Distribution: 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:
-
*args
(Any
, default:()
) βArguments to be passed to the likelihood's
predict
method. -
**kwargs
(Any
, default:{}
) βKeyword arguments to be passed to the likelihood's
predict
method.
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.
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:
-
Distribution
βtfd.Distribution: The likelihood function.
predict
Evaluate the pointwise predictive distribution.
Evaluate the pointwise predictive distribution, given a Gaussian process posterior and likelihood parameters.
Parameters:
-
dist
(Distribution
) βThe Gaussian process posterior, evaluated at a finite set of test points.
Returns:
-
Distribution
βtfd.Distribution: The pointwise predictive distribution.