trieste.acquisition.function.function#

This module contains acquisition function builders, which build and define our acquisition functions — functions that estimate the utility of evaluating sets of candidate points.

Module Contents#

class ProbabilityOfImprovement[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.ProbabilisticModel]

Builder for the probability of improvement function, where the “best” value is taken to be the minimum of the posterior mean at observed points.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model.

  • dataset – The data from the observer. Must be populated.

Returns:

The probability of improvement function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

Raises:

tf.errors.InvalidArgumentError – If dataset is empty.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model.

  • dataset – The data from the observer. Must be populated.

class ExpectedImprovement(search_space: trieste.space.SearchSpace | None = None)[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.ProbabilisticModel]

Builder for the expected improvement function where the “best” value is taken to be the minimum of the posterior mean at observed points.

In the presence of constraints in the search_space the “best” value is computed only at the feasible query points. If there are no feasible points, the “best” value is instead taken to be the maximum of the posterior mean at all observed points.

Parameters:

search_space – The global search space over which the optimisation is defined. This is only used to determine explicit constraints.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model.

  • dataset – The data from the observer. Must be populated.

Returns:

The expected improvement function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

Raises:

tf.errors.InvalidArgumentError – If dataset is empty.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model.

  • dataset – The data from the observer. Must be populated.

class expected_improvement(model: trieste.models.ProbabilisticModel, eta: trieste.types.TensorType)[source]#

Bases: trieste.acquisition.interface.AcquisitionFunctionClass

An AcquisitionFunctionClass is an acquisition function represented using a class rather than as a standalone function. Using a class to represent an acquisition function makes it easier to update it, to avoid having to retrace the function on every call.

Return the Expected Improvement (EI) acquisition function for single-objective global optimization. Improvement is with respect to the current “best” observation eta, where an improvement moves towards the objective function’s minimum and the expectation is calculated with respect to the model posterior. For model posterior \(f\), this is

\[x \mapsto \mathbb E \left[ \max (\eta - f(x), 0) \right]\]

This function was introduced by Mockus et al, 1975. See [JSW98] for details.

Parameters:
  • model – The model of the objective function.

  • eta – The “best” observation.

Returns:

The expected improvement function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

update(eta: trieste.types.TensorType) None[source]#

Update the acquisition function with a new eta value.

__call__(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Call acquisition function.

class AugmentedExpectedImprovement[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.interfaces.SupportsGetObservationNoise]

Builder for the augmented expected improvement function for optimization single-objective optimization problems with high levels of observation noise.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.models.interfaces.SupportsGetObservationNoise, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model.

  • dataset – The data from the observer. Must be populated.

Returns:

The expected improvement function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

Raises:

tf.errors.InvalidArgumentError – If dataset is empty.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.interfaces.SupportsGetObservationNoise, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model.

  • dataset – The data from the observer. Must be populated.

class augmented_expected_improvement(model: trieste.models.interfaces.SupportsGetObservationNoise, eta: trieste.types.TensorType)[source]#

Bases: trieste.acquisition.interface.AcquisitionFunctionClass

An AcquisitionFunctionClass is an acquisition function represented using a class rather than as a standalone function. Using a class to represent an acquisition function makes it easier to update it, to avoid having to retrace the function on every call.

Return the Augmented Expected Improvement (AEI) acquisition function for single-objective global optimization under homoscedastic observation noise. Improvement is with respect to the current “best” observation eta, where an improvement moves towards the objective function’s minimum and the expectation is calculated with respect to the model posterior. In contrast to standard EI, AEI has an additional multiplicative factor that penalizes evaluations made in areas of the space with very small posterior predictive variance. Thus, when applying standard EI to noisy optimisation problems, AEI avoids getting trapped and repeatedly querying the same point. For model posterior \(f\), this is .. math:: x mapsto EI(x) * left(1 - frac{tau^2}{sqrt{s^2(x)+tau^2}}right), where \(s^2(x)\) is the predictive variance and \(\tau\) is observation noise. This function was introduced by Huang et al, 2006. See [HANZ06] for details.

Parameters:
  • model – The model of the objective function.

  • eta – The “best” observation.

Returns:

The expected improvement function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one or a model without homoscedastic observation noise.

update(eta: trieste.types.TensorType) None[source]#

Update the acquisition function with a new eta value and noise variance.

__call__(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Call acquisition function.

class NegativeLowerConfidenceBound(beta: float = 1.96)[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.ProbabilisticModel]

Builder for the negative of the lower confidence bound. The lower confidence bound is typically minimised, so the negative is suitable for maximisation.

Parameters:

beta – Weighting given to the variance contribution to the lower confidence bound. Must not be negative.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model.

  • dataset – Unused.

Returns:

The negative lower confidence bound function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

Raises:

ValueError – If beta is negative.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model.

  • dataset – Unused.

class NegativePredictiveMean[source]#

Bases: NegativeLowerConfidenceBound

Builder for the negative of the predictive mean. The predictive mean is minimised on minimising the objective function. The negative predictive mean is therefore maximised.

Parameters:

beta – Weighting given to the variance contribution to the lower confidence bound. Must not be negative.

lower_confidence_bound(model: trieste.models.ProbabilisticModel, beta: float) trieste.acquisition.interface.AcquisitionFunction[source]#

The lower confidence bound (LCB) acquisition function for single-objective global optimization.

\[x^* \mapsto \mathbb{E} [f(x^*)|x, y] - \beta \sqrt{ \mathrm{Var}[f(x^*)|x, y] }\]

See [SKSK10] for details.

Parameters:
  • model – The model of the objective function.

  • beta – The weight to give to the standard deviation contribution of the LCB. Must not be negative.

Returns:

The lower confidence bound function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

Raises:

tf.errors.InvalidArgumentError – If beta is negative.

class ProbabilityOfFeasibility(threshold: float | trieste.types.TensorType)[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.ProbabilisticModel]

Uses the probability_below_threshold() function to build a probability of feasiblity acquisition function, defined in [GKZ+14] as

\[\int_{-\infty}^{\tau} p(c(\mathbf{x}) | \mathbf{x}, \mathcal{D}) \mathrm{d} c(\mathbf{x}) \qquad ,\]

where \(\tau\) is a threshold. Values below the threshold are considered feasible by the constraint function. See also [SWJ98] for details.

Parameters:

threshold – The (scalar) probability of feasibility threshold.

Raises:

ValueError (or InvalidArgumentError) – If threshold is not a scalar.

__repr__() str[source]#

Return repr(self).

property threshold: float | trieste.types.TensorType[source]#

The probability of feasibility threshold.

prepare_acquisition_function(model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model.

  • dataset – Unused.

Returns:

The probability of feasibility function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model.

  • dataset – Unused.

class probability_below_threshold(model: trieste.models.ProbabilisticModel, threshold: float | trieste.types.TensorType)[source]#

Bases: trieste.acquisition.interface.AcquisitionFunctionClass

An AcquisitionFunctionClass is an acquisition function represented using a class rather than as a standalone function. Using a class to represent an acquisition function makes it easier to update it, to avoid having to retrace the function on every call.

The probability of being below the threshold. This brings together commonality between probability of improvement and probability of feasiblity. Probability is is caculated with respect to the model posterior. For model posterior \(f\), this is .. math:: x mapsto mathbb P left (f(x) < eta)right] where \(\eta\) is the threshold. :param model: The model of the objective function. :param threshold: The (scalar) probability of feasibility threshold. :return: The probability of feasibility function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one. :raise ValueError or tf.errors.InvalidArgumentError: If threshold is not a scalar.

__call__(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Call acquisition function.

update(threshold: trieste.types.TensorType) None[source]#

Update the acquisition function with a new threshold value.

class FastConstraintsFeasibility(search_space: trieste.space.SearchSpace, smoothing_function: Callable[[trieste.types.TensorType], trieste.types.TensorType] | None = None)[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.ProbabilisticModel]

Builds a feasiblity acquisition function from the residuals of explicit constraints defined in the search space.

Parameters:
  • search_space – The global search space over which the feasibility of the constraints is defined.

  • smoothing_function – The smoothing function used for constraints residuals. The default is CDF of the Normal distribution with a scale of 1e-3.

Raises:

NotImplementedError – If the search_space does not have constraints.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – Unused.

  • dataset – Unused.

Returns:

The function for feasibility of constraints.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – Unused.

  • dataset – Unused.

Returns:

The function for feasibility of constraints.

fast_constraints_feasibility(search_space: trieste.space.SearchSpace, smoothing_function: Callable[[trieste.types.TensorType], trieste.types.TensorType] | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#

Returns a feasiblity acquisition function from the residuals of explicit constraints defined in the search space.

Parameters:
  • search_space – The global search space over which the feasibility of the constraints is defined.

  • smoothing_function – The smoothing function used for constraints residuals. The default is CDF of the Normal distribution with a scale of 1e-3.

Returns:

The function for feasibility of constraints.

Raises:

NotImplementedError – If the search_space does not have constraints.

class ExpectedConstrainedImprovement(objective_tag: trieste.types.Tag, constraint_builder: trieste.acquisition.interface.AcquisitionFunctionBuilder[trieste.acquisition.interface.ProbabilisticModelType], min_feasibility_probability: float | trieste.types.TensorType = 0.5, search_space: trieste.space.SearchSpace | None = None)[source]#

Bases: trieste.acquisition.interface.AcquisitionFunctionBuilder[trieste.acquisition.interface.ProbabilisticModelType]

Builder for the expected constrained improvement acquisition function defined in [GKZ+14]. The acquisition function computes the expected improvement from the best feasible point, where feasible points are those that (probably) satisfy some constraint. Where there are no feasible points, this builder simply builds the constraint function.

Parameters:
  • objective_tag – The tag for the objective data and model.

  • constraint_builder – The builder for the constraint function.

  • min_feasibility_probability – The minimum probability of feasibility for a “best point” to be considered feasible.

  • search_space – The global search space over which the optimisation is defined. This is only used to determine explicit constraints.

Raises:

ValueError (or tf.errors.InvalidArgumentError) – If min_feasibility_probability is not a scalar in the unit interval \([0, 1]\).

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(models: Mapping[trieste.types.Tag, trieste.acquisition.interface.ProbabilisticModelType], datasets: Mapping[trieste.types.Tag, trieste.data.Dataset] | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • models – The models over each tag.

  • datasets – The data from the observer.

Returns:

The expected constrained improvement acquisition function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

Raises:
  • KeyError – If objective_tag is not found in datasets and models.

  • tf.errors.InvalidArgumentError – If the objective data is empty.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, models: Mapping[trieste.types.Tag, trieste.acquisition.interface.ProbabilisticModelType], datasets: Mapping[trieste.types.Tag, trieste.data.Dataset] | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • models – The models for each tag.

  • datasets – The data from the observer.

_update_expected_improvement_fn(objective_model: trieste.acquisition.interface.ProbabilisticModelType, feasible_mean: trieste.types.TensorType) None[source]#

Set or update the unconstrained expected improvement function.

Parameters:
  • objective_model – The objective model.

  • feasible_mean – The mean of the feasible query points.

class MonteCarloExpectedImprovement(sample_size: int, *, jitter: float = DEFAULTS.JITTER)[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.interfaces.HasReparamSampler]

Builder for a Monte Carlo-based expected improvement function for use with a model without analytical expected improvement (e.g. a deep GP). The “best” value is taken to be the minimum of the posterior mean at observed points. See monte_carlo_expected_improvement for details.

Parameters:
  • sample_size – The number of samples for each batch of points.

  • jitter – The jitter for the reparametrization sampler.

Raises:

tf.errors.InvalidArgumentError – If sample_size is not positive, or jitter is negative.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.models.interfaces.HasReparamSampler, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model over the specified dataset. Must have output dimension [1].

  • dataset – The data from the observer. Cannot be empty.

Returns:

The estimated expected improvement acquisition function.

Raises:

ValueError (or InvalidArgumentError) – If dataset is not populated, model does not have an output dimension of [1] or does not have a reparam_sample method.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.interfaces.HasReparamSampler, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model. Must have output dimension [1]. Unused here.

  • dataset – The data from the observer. Cannot be empty

class monte_carlo_expected_improvement(sampler: trieste.models.ReparametrizationSampler[trieste.models.interfaces.HasReparamSampler], eta: trieste.types.TensorType)[source]#

Bases: trieste.acquisition.interface.AcquisitionFunctionClass

Return a Monte Carlo based Expected Improvement (EI) acquisition function for single-objective global optimization. Improvement is with respect to the current “best” observation eta, where an improvement moves towards the objective function’s minimum and the expectation is calculated with respect to the model posterior. For model posterior \(f\), this is

\[x \mapsto \mathbb E \left[ \max (\eta - f(x), 0) \right].\]

For the Monte Carlo version, the expectation is calculated by samples that we save. See [WHD18] for details.

Parameters:
  • sampler – The model sampler of the objective function.

  • eta – The “best” observation.

Returns:

The Monte Carlo expected improvement function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

update(eta: trieste.types.TensorType) None[source]#

Update the acquisition function with a new eta value.

__call__(at: trieste.types.TensorType) trieste.types.TensorType[source]#

Call acquisition function.

class MonteCarloAugmentedExpectedImprovement(sample_size: int, *, jitter: float = DEFAULTS.JITTER)[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.interfaces.SupportsReparamSamplerObservationNoise]

Builder for a Monte Carlo-based augmented expected improvement function for use with a model without analytical augmented expected improvement (e.g. a deep GP). The “best” value is taken to be the minimum of the posterior mean at observed points. See monte_carlo_augmented_expected_improvement for details.

Parameters:
  • sample_size – The number of samples for each batch of points.

  • jitter – The jitter for the reparametrization sampler.

Raises:

tf.errors.InvalidArgumentError – If sample_size is not positive, or jitter is negative.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.models.interfaces.SupportsReparamSamplerObservationNoise, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model over the specified dataset. Must have output dimension [1].

  • dataset – The data from the observer. Cannot be empty.

Returns:

The estimated expected improvement acquisition function.

Raises:

ValueError (or InvalidArgumentError) – If dataset is not populated, model does not have an output dimension of [1], does not have a reparam_sample method, or does not support observation noise.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.interfaces.SupportsReparamSamplerObservationNoise, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model. Must have output dimension [1]. Unused here

  • dataset – The data from the observer. Cannot be empty.

class monte_carlo_augmented_expected_improvement(model: trieste.models.interfaces.SupportsReparamSamplerObservationNoise, sampler: trieste.models.ReparametrizationSampler[trieste.models.interfaces.SupportsReparamSamplerObservationNoise], eta: trieste.types.TensorType)[source]#

Bases: trieste.acquisition.interface.AcquisitionFunctionClass

Return a Monte Carlo based Augmented Expected Improvement (AEI) acquisition function for single-objective global optimization with high levels of observation noise. See [WHD18] for details on using the reparametrization trick for optimizing acquisition functions and [HANZ06]: for details of AEI.

Parameters:
  • model – The model of the objective function.

  • sampler – The model sampler of the objective function.

  • eta – The “best” observation.

Returns:

The Monte Carlo expected improvement function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

update(eta: trieste.types.TensorType) None[source]#

Update the acquisition function with a new eta and noise variance

__call__(at: trieste.types.TensorType) trieste.types.TensorType[source]#

Call acquisition function.

class BatchMonteCarloExpectedImprovement(sample_size: int, *, jitter: float = DEFAULTS.JITTER)[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.interfaces.HasReparamSampler]

Expected improvement for batches of points (or \(q\)-EI), approximated using Monte Carlo estimation with the reparametrization trick. See [GLRC10a] for details. Improvement is measured with respect to the minimum predictive mean at observed query points. This is calculated in BatchMonteCarloExpectedImprovement by assuming observations at new points are independent from those at known query points. This is faster, but is an approximation for noisy observers.

Parameters:
  • sample_size – The number of samples for each batch of points.

  • jitter – The size of the jitter to use when stabilising the Cholesky decomposition of the covariance matrix.

Raises:

tf.errors.InvalidArgumentError – If sample_size is not positive, or jitter is negative.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.models.interfaces.HasReparamSampler, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model. Must have event shape [1].

  • dataset – The data from the observer. Must be populated.

Returns:

The batch expected improvement acquisition function.

Raises:

ValueError (or InvalidArgumentError) – If dataset is not populated, or model does not have an event shape of [1].

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.interfaces.HasReparamSampler, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model. Must have event shape [1].

  • dataset – The data from the observer. Must be populated.

class batch_monte_carlo_expected_improvement(sample_size: int, model: trieste.models.interfaces.HasReparamSampler, eta: trieste.types.TensorType, jitter: float)[source]#

Bases: trieste.acquisition.interface.AcquisitionFunctionClass

An AcquisitionFunctionClass is an acquisition function represented using a class rather than as a standalone function. Using a class to represent an acquisition function makes it easier to update it, to avoid having to retrace the function on every call.

Parameters:
  • sample_size – The number of Monte-Carlo samples.

  • model – The model of the objective function.

  • eta – The “best” observation.

  • jitter – The size of the jitter to use when stabilising the Cholesky decomposition of the covariance matrix.

Returns:

The expected improvement function. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

update(eta: trieste.types.TensorType) None[source]#

Update the acquisition function with a new eta value and reset the reparam sampler.

__call__(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Call acquisition function.

class BatchExpectedImprovement(sample_size: int, *, jitter: float = DEFAULTS.JITTER)[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.ProbabilisticModel]

Accurate approximation of the batch expected improvement, using the method of Chvallier and Ginsbourger [CG13].

Internally, this uses a highly accurate approximation of the cumulative density function of the multivariate Gaussian, developed by Alan Genz [GT16].

Initialise the BatchExpectedImprovement instance.

Parameters:
  • sample_size – int, number of Sobol samples to use.

  • jitter – float, amount of jitter for Cholesky factorisations.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model. Must have event shape [1].

  • dataset – The data from the observer. Must be populated.

Returns:

The batch expected improvement acquisition function.

Raises:

ValueError (or InvalidArgumentError) – If dataset is not populated, or model does not have an event shape of [1].

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model. Must have event shape [1].

  • dataset – The data from the observer. Must be populated.

class batch_expected_improvement(sample_size: int, model: trieste.models.ProbabilisticModel, eta: trieste.types.TensorType, jitter: float)[source]#

Bases: trieste.acquisition.interface.AcquisitionFunctionClass

An AcquisitionFunctionClass is an acquisition function represented using a class rather than as a standalone function. Using a class to represent an acquisition function makes it easier to update it, to avoid having to retrace the function on every call.

Initialise the batch_expected_improvement instance.

Parameters:
  • sample_size – int, number of samples to use.

  • model – Gaussian process regression model.

  • eta – Tensor of shape (,), expected improvement threshold. This is the best value observed so far durin the BO loop.

  • jitter – float, amount of jitter for Cholesky factorisations.

update(eta: trieste.types.TensorType) None[source]#

Update the acquisition function with a new eta value and reset the reparam sampler.

_compute_bm(mean: tensorflow.Tensor, threshold: tensorflow.Tensor) trieste.types.TensorType[source]#

Helper function for the batch expected improvement, which computes the tensors b and m as detailed in Chevalier and Ginsbourger [CG13].

Parameters:
  • mean – Tensor of shape (B, Q)

  • threshold – Tensor of shape (B,)

Returns b:

Tensor of shape (B, Q, Q)

Returns m:

Tensor of shape (B, Q, Q)

_delta(idx: int, dim: int, B: int, transpose: bool, dtype: tensorflow.DType) trieste.types.TensorType[source]#

Helper function for the _compute_Sigma function, which computes a delta tensor of shape (B, idx, idx) such that

delta[B, i, :] = 1 if i == idx delta[B, i, :] = 0 otherwise.

If transpose == True, then the last two dimensions of the tensor are transposed, in which case

delta[B, :, i] = 1 if i == idx delta[B, :, i] = 0 otherwise.

Parameters:
  • idx – Index for entries equal to 1.

  • dim – Dimension of the last and second to last axes.

  • B – Leading dimension of tensor.

  • transpose – Whether to transpose the last two dimensions or not.

  • dtype – The dtype of the tensor, either tf.float32 or tf.float64.

_compute_Sigma(covariance: tensorflow.Tensor) trieste.types.TensorType[source]#

Helper function for the batch expected improvement, which computes the tensor Sigma, as detailed in Chevalier and Ginsbourger [CG13].

Parameters:

covariance – Tensor of shape (B, Q, Q)

Returns Sigma:

Tensor of shape (B, Q, Q, Q)

_compute_p(m_reshaped: tensorflow.Tensor, b_reshaped: tensorflow.Tensor, Sigma_reshaped: tensorflow.Tensor, mvn_cdf: Callable[[trieste.types.TensorType, trieste.types.TensorType, trieste.types.TensorType, float], trieste.types.TensorType]) trieste.types.TensorType[source]#

Helper function for the batch expected improvement, which computes the tensor p, as detailed in Chevalier and Ginsbourger [CG13].

Parameters:
  • m_reshaped – Tensor of shape (BQ, Q)

  • b_reshaped – Tensor of shape (BQ, Q)

  • Sigma_reshaped – Tensor of shape (BQ, Q, Q)

Returns p:

Tensor of shape (B, Q)

_compute_c(m_reshaped: tensorflow.Tensor, b_reshaped: tensorflow.Tensor, Sigma_reshaped: tensorflow.Tensor) trieste.types.TensorType[source]#

Helper function for the batch expected improvement, which computes the tensor c, which is the c^{(i)} tensor detailed in Chevalier and Ginsbourger [CG13].

Parameters:
  • m_reshaped – Tensor of shape (BQ, Q)

  • b_reshaped – Tensor of shape (BQ, Q)

  • Sigma_reshaped – Tensor of shape (BQ, Q, Q)

Returns c:

Tensor of shape (B, Q, Q-1)

_compute_R(Sigma_reshaped: tensorflow.Tensor) trieste.types.TensorType[source]#

Helper function for the batch expected improvement, which computes the tensor R, which is the Sigma^{(i)} tensor detailed in Chevalier and Ginsbourger [CG13].

Parameters:

Sigma_reshaped – Tensor of shape (BQ, Q, Q)

Returns R:

Tensor of shape (B, Q-1, Q-1)

_compute_Phi(c: tensorflow.Tensor, R: tensorflow.Tensor, mvn_cdf: Callable[[trieste.types.TensorType, trieste.types.TensorType, trieste.types.TensorType, float], trieste.types.TensorType]) trieste.types.TensorType[source]#

Helper function for the batch expected improvement, which computes the tensor Phi, which is the tensor of multivariate Gaussian CDFs, in the inner sum of the equation (3) in Chevalier and Ginsbourger [CG13].

Parameters:
  • c – Tensor of shape (BQ, Q, Q-1).

  • R – Tensor of shape (BQ, Q, Q-1, Q-1).

  • mvn_cdf – Multivariate Gaussian CDF, made using MultivariateNormalCDF.

Returns Phi:

Tensor of multivariate Gaussian CDFs.

_compute_batch_expected_improvement(mean: tensorflow.Tensor, covariance: tensorflow.Tensor, threshold: tensorflow.Tensor, mvn_cdf_1: Callable[[trieste.types.TensorType, trieste.types.TensorType, trieste.types.TensorType, float], trieste.types.TensorType], mvn_cdf_2: Callable[[trieste.types.TensorType, trieste.types.TensorType, trieste.types.TensorType, float], trieste.types.TensorType]) trieste.types.TensorType[source]#

Accurate Monte Carlo approximation of the batch expected improvement, using the method of Chevalier and Ginsbourger [CG13].

Parameters:
  • mean – Tensor of shape (B, Q).

  • covariance – Tensor of shape (B, Q, Q).

  • threshold – Tensor of shape (B, Q).

  • mvn_cdf_1 – Callable computing the multivariate CDF of a Q-dimensional Gaussian.

  • mvn_cdf_2 – Callable computing the multivariate CDF of a (Q-1)-dimensional Gaussian.

Returns ei:

Tensor of shape (B,), expected improvement.

__call__(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Computes the accurate approximation of the multi-point expected improvement.

Parameters:

x – Tensor of shape (B, Q, D).

Returns ei:

Tensor of shape (B,), expected improvement.

class MultipleOptimismNegativeLowerConfidenceBound(search_space: trieste.space.SearchSpace)[source]#

Bases: trieste.acquisition.interface.SingleModelVectorizedAcquisitionBuilder[trieste.models.ProbabilisticModel]

A simple parallelization of the lower confidence bound acquisition function that produces a vectorized acquisition function which can efficiently optimized even for large batches.

See [TPD20] for details.

Parameters:

search_space – The global search space over which the optimisation is defined.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model.

  • dataset – Unused.

Returns:

The multiple optimism negative lower confidence bound function.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.models.ProbabilisticModel, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model.

  • dataset – Unused.

class multiple_optimism_lower_confidence_bound(model: trieste.models.ProbabilisticModel, search_space_dim: int)[source]#

Bases: trieste.acquisition.interface.AcquisitionFunctionClass

The multiple optimism lower confidence bound (MOLCB) acquisition function for single-objective global optimization.

Each batch dimension of this acquisiton function correponds to a lower confidence bound acquisition function with different beta values, i.e. each point in a batch chosen by this acquisition function lies on a gradient of exploration/exploitation trade-offs.

We choose the different beta values following the cdf method of [TPD20]. See their paper for more details.

Parameters:
  • model – The model of the objective function.

  • search_space_dim – The dimensions of the optimisation problem’s search space.

Raises:

tf.errors.InvalidArgumentError – If search_space_dim is not postive.

__call__(x: trieste.types.TensorType) trieste.types.TensorType[source]#

Call acquisition function.

class MakePositive(base_acquisition_function_builder: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.acquisition.interface.ProbabilisticModelType])[source]#

Bases: trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.acquisition.interface.ProbabilisticModelType]

Converts an acquisition function builder into one that only returns positive values, via \(x \mapsto \log(1 + \exp(x))\).

This is sometimes a useful transformation: for example, converting non-batch acquisition functions into batch acquisition functions with local penalization requires functions that only return positive values.

Parameters:

base_acquisition_function_builder – Base acquisition function to be made positive.

__repr__() str[source]#

Return repr(self).

prepare_acquisition_function(model: trieste.acquisition.interface.ProbabilisticModelType, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • model – The model.

  • dataset – The data to use to build the acquisition function (optional).

Returns:

An acquisition function.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: trieste.acquisition.interface.ProbabilisticModelType, dataset: trieste.data.Dataset | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model.

  • dataset – The data from the observer (optional).

Returns:

The updated acquisition function.