gpflow.quadrature

gpflow.quadrature.hermgauss

gpflow.quadrature.hermgauss(n: int)[source]
Parameters

n (int) –

gpflow.quadrature.mvhermgauss

gpflow.quadrature.mvhermgauss(H: int, D: int)[source]

Return the evaluation locations ‘xn’, and weights ‘wn’ for a multivariate Gauss-Hermite quadrature.

The outputs can be used to approximate the following type of integral: int exp(-x)*f(x) dx ~ sum_i w[i,:]*f(x[i,:])

Parameters
  • H (int) – Number of Gauss-Hermite evaluation points.

  • D (int) – Number of input dimensions. Needs to be known at call-time.

Returns

eval_locations ‘x’ (H**DxD), weights ‘w’ (H**D)

gpflow.quadrature.mvnquad

gpflow.quadrature.mvnquad(func, means, covs, H: int, Din: int = None, Dout=None)[source]

Computes N Gaussian expectation integrals of a single function ‘f’ using Gauss-Hermite quadrature. :param f: integrand function. Takes one input of shape ?xD. :param means: NxD :param covs: NxDxD :type H: int :param H: Number of Gauss-Hermite evaluation points. :type Din: Optional[int] :param Din: Number of input dimensions. Needs to be known at call-time. :param Dout: Number of output dimensions. Defaults to (). Dout is assumed to leave out the item index, i.e. f actually maps (?xD)->(?x*Dout). :return: quadratures (N,*Dout)

gpflow.quadrature.ndiag_mc

gpflow.quadrature.ndiag_mc(funcs, S: int, Fmu, Fvar, logspace: bool = False, epsilon=None, **Ys)[source]

Computes N Gaussian expectation integrals of one or more functions using Monte Carlo samples. The Gaussians must be independent.

Parameters
  • funcs – the integrand(s): Callable or Iterable of Callables that operates elementwise

  • S (int) – number of Monte Carlo sampling points

  • Fmu – array/tensor

  • Fvar – array/tensor

  • logspace (bool) – if True, funcs are the log-integrands and this calculates the log-expectation of exp(funcs)

  • **Ys

    arrays/tensors; deterministic arguments to be passed by name

Fmu, Fvar, Ys should all have same shape, with overall size N :return: shape is the same as that of the first Fmu

gpflow.quadrature.ndiagquad

gpflow.quadrature.ndiagquad(funcs, H: int, Fmu, Fvar, logspace: bool = False, **Ys)[source]

Computes N Gaussian expectation integrals of one or more functions using Gauss-Hermite quadrature. The Gaussians must be independent.

The means and variances of the Gaussians are specified by Fmu and Fvar. The N-integrals are assumed to be taken wrt the last dimensions of Fmu, Fvar.

Parameters
  • funcs – the integrand(s): Callable or Iterable of Callables that operates elementwise

  • H (int) – number of Gauss-Hermite quadrature points

  • Fmu – array/tensor or Din-tuple/list thereof

  • Fvar – array/tensor or Din-tuple/list thereof

  • logspace (bool) – if True, funcs are the log-integrands and this calculates the log-expectation of exp(funcs)

  • **Ys

    arrays/tensors; deterministic arguments to be passed by name

Fmu, Fvar, Ys should all have same shape, with overall size N :return: shape is the same as that of the first Fmu