gpflow.quadrature.gauss_hermite#

Functions#

gpflow.quadrature.gauss_hermite.gh_points_and_weights#

gpflow.quadrature.gauss_hermite.gh_points_and_weights(n_gh)[source]#

Given the number of Gauss-Hermite points n_gh, returns the points z and the weights dz to perform the following uni-dimensional gaussian quadrature:

X ~ N(mean, stddev²) E[f(X)] = ∫ f(x) p(x) dx = sum_{i=1}^{n_gh} f(mean + stddev*z_i) dz_i

Parameters:

n_gh (int) – Number of Gauss-Hermite points

Return type:

Tuple[Tensor, Tensor]

Returns:

  • return[0] has shape [N].

  • return[1] has shape [N].

Points z and weights dz to compute uni-dimensional gaussian expectation

gpflow.quadrature.gauss_hermite.list_to_flat_grid#

gpflow.quadrature.gauss_hermite.list_to_flat_grid(xs)[source]#
Parameters:

xs (Sequence[Union[ndarray[Any, Any], Tensor, Variable, Parameter]]) –

  • xs[all] has shape [.].

List with d rank-1 Tensors, with shapes N1, N2, …, Nd

Return type:

Tensor

Returns:

  • return has shape [N_product, D].

Tensor with shape [N1*N2*…*Nd, d] representing the flattened d-dimensional grid built from the input tensors xs

gpflow.quadrature.gauss_hermite.ndgh_points_and_weights#

gpflow.quadrature.gauss_hermite.ndgh_points_and_weights(dim, n_gh)[source]#
Parameters:
  • dim (int) – dimension of the multivariate normal

  • n_gh (int) – number of Gauss-Hermite points per dimension

Return type:

Tuple[Tensor, Tensor]

Returns:

  • return[0] has shape [n_quad_points, D].

  • return[1] has shape [n_quad_points, 1].

points Z, Tensor with shape [n_gh**dim, D], and weights dZ, Tensor with shape [n_gh**dim, 1]

gpflow.quadrature.gauss_hermite.repeat_as_list#

gpflow.quadrature.gauss_hermite.repeat_as_list(x, n)[source]#
Parameters:
  • x (Union[ndarray[Any, Any], Tensor, Variable, Parameter]) –

    • x has shape [batch…].

    Array/Tensor to be repeated

  • n (int) – Integer with the number of repetitions

Return type:

Sequence[Tensor]

Returns:

  • return has shape [n, batch…].

List of n repetitions of Tensor x

gpflow.quadrature.gauss_hermite.reshape_Z_dZ#

gpflow.quadrature.gauss_hermite.reshape_Z_dZ(zs, dzs)[source]#
Parameters:
  • zs (Sequence[Union[ndarray[Any, Any], Tensor, Variable, Parameter]]) –

    • zs[all] has shape [.].

    List with d rank-1 Tensors, with shapes N1, N2, …, Nd

  • dzs (Sequence[Union[ndarray[Any, Any], Tensor, Variable, Parameter]]) –

    • dzs[all] has shape [.].

    List with d rank-1 Tensors, with shapes N1, N2, …, Nd

Return type:

Tuple[Tensor, Tensor]

Returns:

  • return[0] has shape [N_product, D].

  • return[1] has shape [N_product, 1].

points Z, Tensor with shape [N1*N2*…*Nd, D], and weights dZ, Tensor with shape [N1*N2*…*Nd, 1]