GHQuadratureIntegrator#

class gpjax.integrators.GHQuadratureIntegrator(num_points=20)[source]#

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

\[ \int F(t)\exp(-t^2)\mathrm{d}t \approx \sum_{j=1}^J w_j F(t_j) \]
where \(t_j\) and \(w_j\) are the roots and weights of the \(J\)-th order Hermite polynomial \(H_J(t)\) that we can look up in table [link](https://keisan.casio.com/exec/system/1281195844).

Parameters:

num_points (int)

integrate(fun, y, mean, variance, likelihood)[source]#

Compute a quadrature integral.

Parameters:
  • fun (Callable) – the likelihood to be integrated.

  • y (Float[jaxlib._jax.Array, 'N D'] | Float[ndarray, 'N D']) – the observed response variable.

  • mean (Float[jaxlib._jax.Array, 'N D'] | Float[ndarray, 'N D']) – the mean of the variational distribution.

  • variance (Float[jaxlib._jax.Array, 'N D'] | Float[ndarray, 'N D']) – the variance of the variational distribution.

  • likelihood (L | None) – the likelihood function.

Returns:

The expected log likelihood as an array of shape (N,).

Return type:

Float[jaxlib._jax.Array, ‘N’] | Float[ndarray, ‘N’]