Integrators
gpjax.integrators
Likelihood = TypeVar('Likelihood', bound=Union['gpjax.likelihoods.AbstractLikelihood', None])
module-attribute
Gaussian = TypeVar('Gaussian', bound='gpjax.likelihoods.Gaussian')
module-attribute
__all__ = ['AbstractIntegrator', 'GHQuadratureIntegrator', 'AnalyticalGaussianIntegrator']
module-attribute
AbstractIntegrator
dataclass
Base class for integrators.
integrate(fun: Callable, y: Float[Array, 'N D'], mean: Float[Array, 'N D'], variance: Float[Array, 'N D'], likelihood: Likelihood) -> Float[Array, ' N']
abstractmethod
Integrate a function with respect to a Gaussian distribution.
Typically, the function will be the likelihood function and the mean and variance will be the parameters of the variational distribution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fun |
Callable
|
The function to be integrated. |
required |
y |
Float[Array, 'N D']
|
The observed response variable. |
required |
mean |
Float[Array, 'N D']
|
The mean of the variational distribution. |
required |
variance |
Float[Array, 'N D']
|
The variance of the variational distribution. |
required |
likelihood |
AbstractLikelihood
|
The likelihood function. |
required |
__call__(fun: Callable, y: Float[Array, 'N D'], mean: Float[Array, 'N D'], variance: Float[Array, 'N D'], likelihood: Likelihood) -> Float[Array, ' N']
Integrate a function with respect to a Gaussian distribution.
Typically, the function will be the likelihood function and the mean and variance will be the parameters of the variational distribution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fun |
Callable
|
The function to be integrated. |
required |
y |
Float[Array, 'N D']
|
The observed response variable. |
required |
mean |
Float[Array, 'N D']
|
The mean of the variational distribution. |
required |
variance |
Float[Array, 'N D']
|
The variance of the variational distribution. |
required |
likelihood |
AbstractLikelihood
|
The likelihood function. |
required |
GHQuadratureIntegrator
dataclass
Bases: AbstractIntegrator
Compute an integral using Gauss-Hermite quadrature.
Gauss-Hermite quadrature is a method for approximating integrals through a weighted sum of function evaluations at specific points
where and are the roots and weights of the -th order Hermite polynomial that we can look up in table link.
num_points: int = 20
class-attribute
instance-attribute
__call__(fun: Callable, y: Float[Array, 'N D'], mean: Float[Array, 'N D'], variance: Float[Array, 'N D'], likelihood: Likelihood) -> Float[Array, ' N']
Integrate a function with respect to a Gaussian distribution.
Typically, the function will be the likelihood function and the mean and variance will be the parameters of the variational distribution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fun |
Callable
|
The function to be integrated. |
required |
y |
Float[Array, 'N D']
|
The observed response variable. |
required |
mean |
Float[Array, 'N D']
|
The mean of the variational distribution. |
required |
variance |
Float[Array, 'N D']
|
The variance of the variational distribution. |
required |
likelihood |
AbstractLikelihood
|
The likelihood function. |
required |
integrate(fun: Callable, y: Float[Array, 'N D'], mean: Float[Array, 'N D'], variance: Float[Array, 'N D'], likelihood: Likelihood) -> Float[Array, ' N']
Compute a quadrature integral.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fun |
Callable
|
The likelihood to be integrated. |
required |
y |
Float[Array, 'N D']
|
The observed response variable. |
required |
mean |
Float[Array, 'N D']
|
The mean of the variational distribution. |
required |
variance |
Float[Array, 'N D']
|
The variance of the variational distribution. |
required |
likelihood |
AbstractLikelihood
|
The likelihood function. |
required |
Returns:
Type | Description |
---|---|
Float[Array, ' N']
|
Float[Array, 'N']: The expected log likelihood. |
AnalyticalGaussianIntegrator
dataclass
Bases: AbstractIntegrator
Compute the analytical integral of a Gaussian likelihood.
When the likelihood function is Gaussian, the integral can be computed in closed form. For a Gaussian likelihood and a variational distribution , the expected log-likelihood is given by
__call__(fun: Callable, y: Float[Array, 'N D'], mean: Float[Array, 'N D'], variance: Float[Array, 'N D'], likelihood: Likelihood) -> Float[Array, ' N']
Integrate a function with respect to a Gaussian distribution.
Typically, the function will be the likelihood function and the mean and variance will be the parameters of the variational distribution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fun |
Callable
|
The function to be integrated. |
required |
y |
Float[Array, 'N D']
|
The observed response variable. |
required |
mean |
Float[Array, 'N D']
|
The mean of the variational distribution. |
required |
variance |
Float[Array, 'N D']
|
The variance of the variational distribution. |
required |
likelihood |
AbstractLikelihood
|
The likelihood function. |
required |
integrate(fun: Callable, y: Float[Array, 'N D'], mean: Float[Array, 'N D'], variance: Float[Array, 'N D'], likelihood: Gaussian) -> Float[Array, ' N']
Compute a Gaussian integral.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fun |
Callable
|
The Gaussian likelihood to be integrated. |
required |
y |
Float[Array, 'N D']
|
The observed response variable. |
required |
mean |
Float[Array, 'N D']
|
The mean of the variational distribution. |
required |
variance |
Float[Array, 'N D']
|
The variance of the variational distribution. |
required |
likelihood |
Gaussian
|
The Gaussian likelihood function. |
required |
Returns:
Type | Description |
---|---|
Float[Array, ' N']
|
Float[Array, 'N']: The expected log likelihood. |