trieste.acquisition.function.utils
#
This module contains utility functions for acquisition functions.
Module Contents#
- class MultivariateNormalCDF(sample_size: int, dim: int, dtype: tensorflow.DType, num_sobol_skip: int = 0)[source]#
Builds the cumulative density function of the multivariate Gaussian using the Genz approximation detailed in [GT16].
This is a Monte Carlo approximation which is more accurate than a naive Monte Carlo estimate of the expected improvent. In order to use reparametrised samples, the helper accepts a tensor of samples, and the callable uses these fixed samples whenever it is called.
- Parameters:
samples_size – int, number of samples to use.
dim – int, dimension of the multivariate Gaussian.
dtype – tf.DType, data type to use for calculations.
num_sobol_skip – int, number of sobol samples to skip.
- _standard_normal_cdf_and_inverse_cdf(dtype: tensorflow.DType) Tuple[Callable[[trieste.types.TensorType], trieste.types.TensorType], Callable[[trieste.types.TensorType], trieste.types.TensorType]] [source]#
Returns two callables Phi and iPhi, which compute the cumulative density function and inverse cumulative density function of a standard univariate Gaussian.
- Parameters:
dtype – The data type to use, either tf.float32 or tf.float64.
- Returns Phi, iPhi:
Cumulative and inverse cumulative density functions.
- _get_update_indices(B: int, S: int, Q: int, q: int) trieste.types.TensorType [source]#
Returns indices for updating a tensor using tf.tensor_scatter_nd_add, for use within the _mvn_cdf function, for computing the cumulative density function of a multivariate Gaussian. The indices idx returned are such that the following operation
idx = get_update_indices(B, S, Q, q) tensor = tf.tensor_scatter_nd_add(tensor, idx, update)
is equivalent to the numpy operation
tensor = tensor[:, :, q] + update
where tensor is a tensor of shape (B, S, Q).
- Parameters:
B – First dim. of tensor for which the indices are generated.
S – Second dim. of tensor for which the indices are generated.
Q – Third dim. of tensor for which the indices are generated.
q – Index of tensor along fourth dim. to which the update is applied.
- __call__(x: trieste.types.TensorType, mean: trieste.types.TensorType, cov: trieste.types.TensorType, jitter: float = 1e-06) trieste.types.TensorType [source]#
Computes the cumulative density function of the multivariate Gaussian using the Genz approximation.
- Parameters:
x – Tensor of shape (B, Q), batch of points to evaluate CDF at.
mean – Tensor of shape (B, Q), batch of means.
covariance – Tensor of shape (B, Q, Q), batch of covariances.
jitter – float, jitter to use in the Cholesky factorisation.
- Returns mvn_cdf:
Tensor of shape (B,), CDF values.