trieste.acquisition.function#

This folder contains single-objective optimization functions.

Submodules#

Package Contents#

class BayesianActiveLearningByDisagreement(jitter: float = DEFAULTS.JITTER)[source]#

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

Builder for the Bayesian Active Learning By Disagreement acquisition function defined in [HHGL11].

Parameters:

jitter – The size of the jitter to avoid numerical problem caused by the log operation if variance is close to zero.

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 determinant of the predictive 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 ExpectedFeasibility(threshold: float, alpha: float = 1, delta: int = 1)[source]#

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

Builder for the Expected feasibility acquisition function for identifying a failure or feasibility region. It implements two related sampling strategies called bichon criterion ([BES+08]) and ranjan criterion ([RBM08]). The goal of both criteria is to sample points with a mean close to the threshold and a high variance.

Parameters:
  • threshold – The failure or feasibility threshold.

  • alpha – The parameter which determines the neighbourhood around the estimated contour line as a percentage of the posterior variance in which to allocate new points. Defaults to value of 1.

  • delta – The parameter identifying which criterion is used, bichon for value of 1 (default) and ranjan for value of 2.

Raises:

ValueError (or InvalidArgumentError) – If arguments are not a scalar, or alpha is not positive, or delta is not 1 or 2.

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 expected 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 – The data from the observer (optional).

Returns:

The updated acquisition function.

class IntegratedVarianceReduction(integration_points: trieste.types.TensorType, threshold: float | Sequence[float] | trieste.types.TensorType | None = None)[source]#

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

Builder for the reduction of the integral of the predicted variance over the search space given a batch of query points.

Parameters:
  • integration_points – set of points to integrate the prediction variance over.

  • threshold – either None, a float or a sequence of 1 or 2 float values.

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

  • dataset – Unused.

Returns:

The integral of the predictive variance.

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

  • model – The model.

  • dataset – Unused.

class PredictiveVariance(jitter: float = DEFAULTS.JITTER)[source]#

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

Builder for the determinant of the predictive covariance matrix over the batch points. For a batch of size 1 it is the same as maximizing the predictive variance.

Parameters:

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

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

  • dataset – Unused.

Returns:

The determinant of the predictive function.

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

  • model – The model.

  • dataset – Unused.

class bayesian_active_learning_by_disagreement(model: trieste.models.ProbabilisticModel, 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.

The Bayesian active learning by disagrement acquisition function computes the information gain of the predictive entropy [HHGL11]. the acquisiton function is calculated by:

\[\mathrm{h}\left(\Phi\left(\frac{\mu_{\boldsymbol{x}, \mathcal{D}}} {\sqrt{\sigma_{\boldsymbol{x}, \mathcal{D}}^{2}+1}}\right)\right) -\frac{C \exp \left(-\frac{\mu_{\boldsymbol{x}, \mathcal{D}}^{2}} {2\left(\sigma_{\boldsymbol{w}, \mathcal{D}}^{+C^{2}}\right)}\right)} {\sqrt{\sigma_{\boldsymbol{x}, \mathcal{D}}^{2}+C^{2}}}\]

Here \(\mathrm{h}(p)\) is defined as:

\[\mathrm{h}(p)=-p \log p-(1-p) \log (1-p)\]

This acquisition function is intended to use for Binary Gaussian Process Classification model with Bernoulli likelihood. It is designed for VGP but other Gaussian approximation of the posterior can be used. SVGP for instance, or some other model that is not currently supported by Trieste. Integrating over nuisance parameters is currently not supported (see equation 6 of the paper).

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

  • jitter – The size of the jitter to avoid numerical problem caused by the log operation if variance is close to zero.

Returns:

The Bayesian Active Learning By Disagreement acquisition function.

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

Call acquisition function.

bichon_ranjan_criterion(model: trieste.models.ProbabilisticModel, threshold: float, alpha: float, delta: int) trieste.acquisition.interface.AcquisitionFunction[source]#

Return the bichon criterion ([BES+08]) and ranjan criterion ([RBM08]) used in Expected feasibility acquisition function for active learning of failure or feasibility regions.

The problem of identifying a failure or feasibility region of a function \(f\) can be formalized as estimating the excursion set, \(\Gamma^* = \{ x \in X: f(x) \ge T\}\), or estimating the contour line, \(C^* = \{ x \in X: f(x) = T\}\), for some threshold \(T\) (see [BGL+12] for more details).

It turns out that probabilistic models can be used as classifiers for identifying where excursion probability is larger than 1/2 and this idea is used to build many sequential sampling strategies. We follow [BGL+12] and use a formulation which provides a common expression for these two criteria:

\[\mathbb{E}[\max(0, (\alpha s(x))^\delta - |T - m(x)|^\delta)]\]

Here \(m(x)\) and \(s(x)\) are the mean and standard deviation of the predictive posterior of a probabilistic model. Bichon criterion is obtained when \(\delta = 1\) while ranjan criterion is obtained when \(\delta = 2\). \(\alpha>0\) is another parameter that acts as a percentage of standard deviation of the posterior around the current boundary estimate where we want to sample. The goal is to sample a point with a mean close to the threshold \(T\) and a high variance, so that the positive difference in the equation above is as large as possible.

Note that only batches of size 1 are allowed.

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

  • threshold – The failure or feasibility threshold.

  • alpha – The parameter which determines the neighbourhood around the estimated contour line as a percentage of the posterior variance in which to allocate new points.

  • delta – The parameter identifying which criterion is used, bichon for value of 1 and ranjan for value of 2.

class integrated_variance_reduction(model: trieste.models.interfaces.FastUpdateModel, integration_points: trieste.types.TensorType, threshold: float | Sequence[float] | trieste.types.TensorType | None = None)[source]#

Bases: trieste.acquisition.interface.AcquisitionFunctionClass

The reduction of the (weighted) average of the predicted variance over the integration points (a.k.a. Integrated Means Square Error or IMSE criterion). See [PGR+10] for details.

The criterion (to maximise) writes as:

\[\int_x (v_{old}(x) - v_{new}(x)) * weights(x),\]

where \(v_{old}(x)\) is the predictive variance of the model at \(x\), and \(v_{new}(x)\) is the updated predictive variance, given that the GP is further conditioned on the query points.

Note that since \(v_{old}(x)\) is constant w.r.t. the query points, this function only returns \(-\int_x v_{new}(x) * weights(x)\).

If no threshold is provided, the goal is to learn a globally accurate model, and the predictive variance (\(v_{new}\)) is used. Otherwise, learning is ‘targeted’ towards regions where the GP is close to particular values, and the variance is weighted by the posterior GP pdf evaluated at the threshold T (if a single value is given) or by the probability that the GP posterior belongs to the interval between the 2 thresholds T1 and T2 (note the slightly different parametrisation compared to [PGR+10] in that case).

This criterion allows batch size > 1. Note that the computational cost grows cubically with the batch size.

This criterion requires a method (conditional_predict_f) to compute the new predictive variance given that query points are added to the data.

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

  • integration_points – Points over which to integrate the objective prediction variance.

  • threshold – Either None, a float or a sequence of 1 or 2 float values. See class docs for details.

Raises:

ValueError (or InvalidArgumentError) – If threshold has more than 2 values.

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

Call acquisition function.

predictive_variance(model: trieste.models.interfaces.SupportsPredictJoint, jitter: float) trieste.acquisition.interface.AcquisitionFunction[source]#

The predictive variance acquisition function for active learning, based on the determinant of the covariance (see [Mac92] for details). Note that the model needs to supply covariance of the joint marginal distribution, which can be expensive to compute.

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

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

class GreedyContinuousThompsonSampling(select_output: Callable[[trieste.types.TensorType], trieste.types.TensorType] = select_nth_output)[source]#

Bases: trieste.acquisition.interface.SingleModelGreedyAcquisitionBuilder[trieste.models.interfaces.HasTrajectorySampler]

Acquisition function builder for performing greedy continuous Thompson sampling. This builder return acquisition functions that are the negatives of approximate samples from the given ProbabilisticModel, as provided by the model’s get_trajectory() method. A set of such samples are to be maximized in a sequential greedy manner to provide the next recommended query points. Note that we actually return the negative of the trajectory, so that our acquisition optimizers (which are all maximizers) can be used to extract the minimisers of trajectories.

For more details about trajectory-based Thompson sampling see [HernandezLRPKAG17] and [WBT+20].

Parameters:

select_output – A method that returns the desired trajectory from a trajectory sampler with shape […, B], where B is a batch dimension. Defaults to the :func:~`trieste.acquisition.utils.select_nth_output` function with output dimension 0.

prepare_acquisition_function(model: trieste.models.interfaces.HasTrajectorySampler, dataset: trieste.data.Dataset | None = None, pending_points: trieste.types.TensorType | None = None) trieste.models.interfaces.TrajectoryFunction[source]#
Parameters:
  • model – The model.

  • dataset – The data from the observer (not used).

  • pending_points – The points already in the current batch (not used).

Returns:

A negated trajectory sampled from the model.

update_acquisition_function(function: trieste.models.interfaces.TrajectoryFunction, model: trieste.models.interfaces.HasTrajectorySampler, dataset: trieste.data.Dataset | None = None, pending_points: trieste.types.TensorType | None = None, new_optimization_step: bool = True) trieste.models.interfaces.TrajectoryFunction[source]#
Parameters:
  • function – The trajectory function to update.

  • model – The model.

  • dataset – The data from the observer (not used).

  • pending_points – The points already in the current batch (not used).

  • new_optimization_step – Indicates whether this call to update_acquisition_function is to start of a new optimization step, of to continue collecting batch of points for the current step. Defaults to True.

Returns:

A new trajectory sampled from the model.

class ParallelContinuousThompsonSampling(select_output: Callable[[trieste.types.TensorType], trieste.types.TensorType] = select_nth_output)[source]#

Bases: trieste.acquisition.interface.SingleModelVectorizedAcquisitionBuilder[trieste.models.interfaces.HasTrajectorySampler]

Acquisition function builder for performing parallel continuous Thompson sampling.

This builder provides broadly the same behavior as our GreedyContinuousThompsonSampler however optimizes trajectory samples in parallel rather than sequentially. Consequently, ParallelContinuousThompsonSampling can choose query points faster than GreedyContinuousThompsonSampler however it has much larger memory usage.

For a convenient way to control the total memory usage of this acquisition function, see our split_acquisition_function_calls wrapper.

Parameters:

select_output – A method that returns the desired trajectory from a trajectory sampler with shape […, B], where B is a batch dimension. Defaults to the :func:~`trieste.acquisition.utils.select_nth_output` function with output dimension 0.

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

  • dataset – The data from the observer (not used).

Returns:

A negated trajectory sampled from the model.

update_acquisition_function(function: trieste.models.interfaces.TrajectoryFunction, model: trieste.models.interfaces.HasTrajectorySampler, dataset: trieste.data.Dataset | None = None) trieste.models.interfaces.TrajectoryFunction[source]#
Parameters:
  • function – The trajectory function to update.

  • model – The model.

  • dataset – The data from the observer (not used).

Returns:

A new trajectory sampled from the model.

class GIBBON(search_space: trieste.space.SearchSpace, num_samples: int = 5, grid_size: int = 1000, min_value_sampler: None = None, rescaled_repulsion: bool = True)[source]#
class GIBBON(search_space: trieste.space.SearchSpace, num_samples: int = 5, grid_size: int = 1000, min_value_sampler: trieste.acquisition.sampler.ThompsonSampler[GIBBONModelType] | None = None, rescaled_repulsion: bool = True)

Bases: trieste.acquisition.interface.SingleModelGreedyAcquisitionBuilder[GIBBONModelType]

The General-purpose Information-Based Bayesian Optimisation (GIBBON) acquisition function of [MLGR21]. GIBBON provides a computationally cheap approximation of the information gained about (i.e the change in entropy of) the objective function’s minimum by evaluating a batch of candidate points. Batches are built in a greedy manner.

This implementation follows [MLGR21] but is modified for function minimisation (rather than maximisation). We sample the objective’s minimum \(y^*\) across a large set of sampled locations via either a Gumbel sampler, an exact Thompson sampler or an approximate random Fourier feature-based Thompson sampler, with the Gumbel sampler being the cheapest but least accurate. Default behavior is to use the exact Thompson sampler.

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

  • num_samples – Number of samples to draw from the distribution over the minimum of the objective function.

  • grid_size – Size of the grid from which to sample the min-values. We recommend scaling this with search space dimension.

  • min_value_sampler – Sampler which samples minimum values.

  • rescaled_repulsion – If True, then downweight GIBBON’s repulsion term to improve batch optimization performance.

Raises:

tf.errors.InvalidArgumentError

If

  • num_samples is not positive, or

  • grid_size is not positive.

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

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

  • pending_points – The points we penalize with respect to.

Returns:

The GIBBON acquisition function modified for objective minimisation.

Raises:

tf.errors.InvalidArgumentError – If dataset is empty.

update_acquisition_function(function: trieste.acquisition.interface.AcquisitionFunction, model: GIBBONModelType, dataset: trieste.data.Dataset | None = None, pending_points: trieste.types.TensorType | None = None, new_optimization_step: bool = True) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • function – The acquisition function to update.

  • model – The model.

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

  • pending_points – Points already chosen to be in the current batch (of shape [M,D]), where M is the number of pending points and D is the search space dimension.

  • new_optimization_step – Indicates whether this call to update_acquisition_function is to start of a new optimization step, or to continue collecting batch of points for the current step. Defaults to True.

Returns:

The updated acquisition function.

class MinValueEntropySearch(search_space: trieste.space.SearchSpace, num_samples: int = 5, grid_size: int = 1000, min_value_sampler: None = None)[source]#
class MinValueEntropySearch(search_space: trieste.space.SearchSpace, num_samples: int = 5, grid_size: int = 1000, min_value_sampler: trieste.acquisition.sampler.ThompsonSampler[trieste.acquisition.interface.ProbabilisticModelType] | None = None)

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

Builder for the max-value entropy search acquisition function modified for objective minimisation. MinValueEntropySearch estimates the information in the distribution of the objective minimum that would be gained by evaluating the objective at a given point.

This implementation largely follows [WJ17] and samples the objective’s minimum \(y^*\) across a large set of sampled locations via either a Gumbel sampler, an exact Thompson sampler or an approximate random Fourier feature-based Thompson sampler, with the Gumbel sampler being the cheapest but least accurate. Default behavior is to use the exact Thompson sampler.

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

  • num_samples – Number of samples to draw from the distribution over the minimum of the objective function.

  • grid_size – Size of the grid from which to sample the min-values. We recommend scaling this with search space dimension.

  • min_value_sampler – Sampler which samples minimum values.

Raises:

tf.errors.InvalidArgumentError

If

  • num_samples or grid_size are negative.

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 from the observer.

Returns:

The max-value entropy search acquisition function modified for objective minimisation. 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.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.

class gibbon_quality_term(model: SupportsCovarianceObservationNoise, samples: 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.

GIBBON’s quality term measures the amount of information that each individual batch element provides about the objective function’s minimal value \(y^*\) (ensuring that evaluations are targeted in promising areas of the space).

Parameters:
  • model – The model of the objective function. GIBBON requires a model with a :method:covariance_between_points method and so GIBBON only supports GaussianProcessRegression models.

  • samples – Samples from the distribution over \(y^*\).

Returns:

GIBBON’s quality term. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

Raises:
  • ValueError or tf.errors.InvalidArgumentError – If samples does not have rank two, or is empty, or if model has no homoscedastic observation noise.

  • AttributeError – If model doesn’t implement covariance_between_points method.

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

Update the acquisition function with new samples.

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

Call acquisition function.

class gibbon_repulsion_term(model: SupportsCovarianceObservationNoise, pending_points: trieste.types.TensorType, rescaled_repulsion: bool = True)[source]#

Bases: trieste.acquisition.interface.UpdatablePenalizationFunction

An UpdatablePenalizationFunction builds and updates a penalization function. Defining a penalization function that can be updated avoids having to retrace on every call.

GIBBON’s repulsion term encourages diversity within the batch (achieving high values for points with low predictive correlation).

The repulsion term \(r=\log |C|\) is given by the log determinant of the predictive correlation matrix \(C\) between the m pending points and the current candidate. The predictive covariance \(V\) can be expressed as :math:V = [[v, A], [A, B]]` for a tensor \(B\) with shape [m,`m`] and so we can efficiently calculate \(|V|\) using the formula for the determinant of block matrices, i.e \(|V| = (v - A^T * B^{-1} * A) * |B|\). Note that when using GIBBON for purely sequential optimization, the repulsion term is not required.

As GIBBON’s batches are built in a greedy manner, i.e sequentially adding points to build a set of m pending points, we need only ever calculate the entropy reduction provided by adding the current candidate point to the current pending points, not the full information gain provided by evaluating all the pending points. This allows for a modest computational saving.

When performing batch BO, GIBBON’s approximation can sometimes become less accurate as its repulsion term dominates. Therefore, we follow the arguments of [MLGR21] and divide GIBBON’s repulsion term by \(B^{2}\). This behavior can be deactivated by setting rescaled_repulsion to False.

Parameters:
  • model – The model of the objective function. GIBBON requires a model with a :method:covariance_between_points method and so GIBBON only supports GaussianProcessRegression models.

  • pending_points – The points already chosen in the current batch.

  • rescaled_repulsion – If True, then downweight GIBBON’s repulsion term to improve batch optimization performance.

Returns:

GIBBON’s repulsion term. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

Raises:
  • ValueError or tf.errors.InvalidArgumentError – If pending_points does not have rank two, or is empty, or if model has no homoscedastic observation noise.

  • AttributeError – If model doesn’t implement covariance_between_points method.

update(pending_points: trieste.types.TensorType, lipschitz_constant: trieste.types.TensorType = None, eta: trieste.types.TensorType = None) None[source]#

Update the repulsion term with new variable values.

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

Call penalization function..

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 max-value entropy search acquisition function (adapted from [WJ17]), modified for objective minimisation. This function calculates the information gain (or change in entropy) in the distribution over the objective minimum \(y^*\), if we were to evaluate the objective at a given point.

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

  • samples – Samples from the distribution over \(y^*\).

Returns:

The max-value entropy search acquisition function modified for objective minimisation. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

Raises:

ValueError or tf.errors.InvalidArgumentError – If samples has rank less than two, or is empty.

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

Update the acquisition function with new samples.

__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.

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 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.

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 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.

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 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]\).

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 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.

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 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.

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.

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.

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.

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.

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 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.

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 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.

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 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.

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.

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.

property threshold: float | trieste.types.TensorType#

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 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.

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 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 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 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.

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.

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 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 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 Fantasizer(base_acquisition_function_builder: trieste.acquisition.interface.AcquisitionFunctionBuilder[trieste.models.interfaces.SupportsPredictJoint] | trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.models.interfaces.SupportsPredictJoint] | None = None, fantasize_method: str = 'KB')[source]#

Bases: trieste.acquisition.interface.GreedyAcquisitionFunctionBuilder[FantasizerModelOrStack]

Builder of the acquisition function maker for greedily collecting batches. Fantasizer allows us to perform batch Bayesian optimization with any standard (non-batch) acquisition function.

Here, every time a query point is chosen by maximising an acquisition function, its corresponding observation is “fantasized”, and the models are conditioned further on this new artificial data.

This implies that the models need to predict what their updated predictions would be given new data, see FastUpdateModel. These equations are for instance in closed form for the GPR model, see [CGE14] (eqs. 8-10) for details.

There are several ways to “fantasize” data: the “kriging believer” heuristic (KB, see [GLRC10b]) uses the mean of the model as observations. “sample” uses samples from the model.

Parameters:
  • base_acquisition_function_builder – The acquisition function builder to use. Defaults to ExpectedImprovement.

  • fantasize_method – The following options are available: “KB” and “sample”. See class docs for more details.

Raises:

tf.errors.InvalidArgumentError – If fantasize_method is not “KB” or “sample”.

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

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

  • pending_points – Points already chosen to be in the current batch (of shape [M,D]), where M is the number of pending points and D is the search space dimension.

Returns:

An acquisition function.

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

  • models – The models over each tag.

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

  • pending_points – Points already chosen to be in the current batch (of shape [M,D]), where M is the number of pending points and D is the search space dimension.

  • new_optimization_step – Indicates whether this call to update_acquisition_function is to start of a new optimization step, of to continue collecting batch of points for the current step. Defaults to True.

Returns:

The updated acquisition function.

class LocalPenalization(search_space: trieste.space.SearchSpace, num_samples: int = 500, penalizer: Callable[[trieste.models.ProbabilisticModel, trieste.types.TensorType, trieste.types.TensorType, trieste.types.TensorType], trieste.acquisition.interface.PenalizationFunction | trieste.acquisition.interface.UpdatablePenalizationFunction] | None = None, base_acquisition_function_builder: trieste.acquisition.function.function.ExpectedImprovement | trieste.acquisition.function.entropy.MinValueEntropySearch[trieste.models.ProbabilisticModel] | trieste.acquisition.function.function.MakePositive[trieste.models.ProbabilisticModel] | None = None)[source]#

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

Builder of the acquisition function maker for greedily collecting batches by local penalization. The resulting AcquisitionFunctionMaker takes in a set of pending points and returns a base acquisition function penalized around those points. An estimate of the objective function’s Lipschitz constant is used to control the size of penalization.

Local penalization allows us to perform batch Bayesian optimization with a standard (non-batch) acquisition function. All that we require is that the acquisition function takes strictly positive values. By iteratively building a batch of points though sequentially maximizing this acquisition function but down-weighted around locations close to the already chosen (pending) points, local penalization provides diverse batches of candidate points.

Local penalization is applied to the acquisition function multiplicatively. However, to improve numerical stability, we perform additive penalization in a log space.

The Lipschitz constant and additional penalization parameters are estimated once when first preparing the acquisition function with no pending points. These estimates are reused for all subsequent function calls.

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

  • num_samples – Size of the random sample over which the Lipschitz constant is estimated. We recommend scaling this with search space dimension.

  • penalizer – The chosen penalization method (defaults to soft penalization). This should be a function that accepts a model, pending points, lipschitz constant and eta and returns a PenalizationFunction.

  • base_acquisition_function_builder – Base acquisition function to be penalized (defaults to expected improvement). Local penalization only supports strictly positive acquisition functions.

Raises:

tf.errors.InvalidArgumentError – If num_samples is not positive.

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

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

  • pending_points – The points we penalize with respect to.

Returns:

The (log) expected improvement penalized with respect to the pending points.

Raises:

tf.errors.InvalidArgumentError – If the dataset is empty.

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

  • model – The model.

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

  • pending_points – Points already chosen to be in the current batch (of shape [M,D]), where M is the number of pending points and D is the search space dimension.

  • new_optimization_step – Indicates whether this call to update_acquisition_function is to start of a new optimization step, of to continue collecting batch of points for the current step. Defaults to True.

Returns:

The updated acquisition function.

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

Bases: local_penalizer

Return the hard local penalization function used for single-objective greedy batch Bayesian optimization in [ARC+19].

Hard penalization is a stronger penalizer than soft penalization and is sometimes more effective See [ARC+19] for details. Our implementation follows theirs, with the penalization from a set of pending points being the product of the individual penalizations.

Parameters:
  • model – The model over the specified dataset.

  • pending_points – The points we penalize with respect to.

  • lipschitz_constant – The estimated Lipschitz constant of the objective function.

  • eta – The estimated global minima.

Returns:

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

Initialize the local penalizer.

Parameters:
  • model – The model over the specified dataset.

  • pending_points – The points we penalize with respect to.

  • lipschitz_constant – The estimated Lipschitz constant of the objective function.

  • eta – The estimated global minima.

Returns:

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

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

Call penalization function..

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

Bases: local_penalizer

Return the soft local penalization function used for single-objective greedy batch Bayesian optimization in [GonzalezDHL16].

Soft penalization returns the probability that a candidate point does not belong in the exclusion zones of the pending points. For model posterior mean \(\mu\), model posterior variance \(\sigma^2\), current “best” function value \(\eta\), and an estimated Lipschitz constant \(L\),the penalization from a set of pending point \(x'\) on a candidate point \(x\) is given by .. math:: phi(x, x’) = frac{1}{2}textrm{erfc}(-z) where \(z = \frac{1}{\sqrt{2\sigma^2(x')}}(L||x'-x|| + \eta - \mu(x'))\).

The penalization from a set of pending points is just product of the individual penalizations. See [GonzalezDHL16] for a full derivation.

Parameters:
  • model – The model over the specified dataset.

  • pending_points – The points we penalize with respect to.

  • lipschitz_constant – The estimated Lipschitz constant of the objective function.

  • eta – The estimated global minima.

Returns:

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

Initialize the local penalizer.

Parameters:
  • model – The model over the specified dataset.

  • pending_points – The points we penalize with respect to.

  • lipschitz_constant – The estimated Lipschitz constant of the objective function.

  • eta – The estimated global minima.

Returns:

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

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

Call penalization function..

class HIPPO(objective_tag: trieste.types.Tag = OBJECTIVE, base_acquisition_function_builder: trieste.acquisition.interface.AcquisitionFunctionBuilder[trieste.acquisition.interface.ProbabilisticModelType] | trieste.acquisition.interface.SingleModelAcquisitionBuilder[trieste.acquisition.interface.ProbabilisticModelType] | None = None)[source]#

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

HIPPO: HIghly Parallelizable Pareto Optimization

Builder of the acquisition function for greedily collecting batches by HIPPO penalization in multi-objective optimization by penalizing batch points by their distance in the objective space. The resulting acquistion function takes in a set of pending points and returns a base multi-objective acquisition function penalized around those points.

Penalization is applied to the acquisition function multiplicatively. However, to improve numerical stability, we perform additive penalization in a log space.

Initializes the HIPPO acquisition function builder.

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

  • base_acquisition_function_builder – Base acquisition function to be penalized. Defaults to Expected Hypervolume Improvement, also supports its constrained version.

prepare_acquisition_function(models: Mapping[trieste.types.Tag, trieste.acquisition.interface.ProbabilisticModelType], datasets: Mapping[trieste.types.Tag, trieste.data.Dataset] | None = None, pending_points: trieste.types.TensorType | None = None) trieste.acquisition.interface.AcquisitionFunction[source]#

Creates a new instance of the acquisition function.

Parameters:
  • models – The models.

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

  • pending_points – The points we penalize with respect to.

Returns:

The HIPPO acquisition function.

Raises:

tf.errors.InvalidArgumentError – If the dataset 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, pending_points: trieste.types.TensorType | None = None, new_optimization_step: bool = True) trieste.acquisition.interface.AcquisitionFunction[source]#

Updates the acquisition function.

Parameters:
  • function – The acquisition function to update.

  • models – The models.

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

  • pending_points – Points already chosen to be in the current batch (of shape [M,D]), where M is the number of pending points and D is the search space dimension.

  • new_optimization_step – Indicates whether this call to update_acquisition_function is to start of a new optimization step, of to continue collecting batch of points for the current step. Defaults to True.

Returns:

The updated acquisition function.

class BatchMonteCarloExpectedHypervolumeImprovement(sample_size: int, reference_point_spec: Sequence[float] | trieste.types.TensorType | Callable[Ellipsis, trieste.types.TensorType] = get_reference_point, *, jitter: float = DEFAULTS.JITTER)[source]#

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

Builder for the batch expected hypervolume improvement acquisition function. The implementation of the acquisition function largely follows [DBB20]

Parameters:
  • sample_size – The number of samples from model predicted distribution for each batch of points.

  • reference_point_spec – this method is used to determine how the reference point is calculated. If a Callable function specified, it is expected to take existing posterior mean-based observations (to screen out the observation noise) and return a reference point with shape [D] (D represents number of objectives). If the Pareto front location is known, this arg can be used to specify a fixed reference point in each bo iteration. A dynamic reference point updating strategy is used by default to set a reference point according to the datasets.

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

Raises:

ValueError (or InvalidArgumentError) – If sample_size is not positive, or jitter is negative.

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 hypervolume improvement acquisition function.

class ExpectedConstrainedHypervolumeImprovement(objective_tag: trieste.types.Tag, constraint_builder: trieste.acquisition.interface.AcquisitionFunctionBuilder[trieste.acquisition.interface.ProbabilisticModelType], min_feasibility_probability: float | trieste.types.TensorType = 0.5, reference_point_spec: Sequence[float] | trieste.types.TensorType | Callable[Ellipsis, trieste.types.TensorType] = get_reference_point)[source]#

Bases: trieste.acquisition.function.function.ExpectedConstrainedImprovement[trieste.acquisition.interface.ProbabilisticModelType]

Builder for the constrained expected hypervolume improvement acquisition function. This function essentially combines ExpectedConstrainedImprovement and ExpectedHypervolumeImprovement.

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.

  • reference_point_spec – this method is used to determine how the reference point is calculated. If a Callable function specified, it is expected to take existing posterior mean-based feasible observations (to screen out the observation noise) and return a reference point with shape [D] (D represents number of objectives). If the feasible Pareto front location is known, this arg can be used to specify a fixed reference point in each bo iteration. A dynamic reference point updating strategy is used by default to set a reference point according to the datasets.

_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 ExpectedHypervolumeImprovement(reference_point_spec: Sequence[float] | trieste.types.TensorType | Callable[Ellipsis, trieste.types.TensorType] = get_reference_point)[source]#

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

Builder for the expected hypervolume improvement acquisition function. The implementation of the acquisition function largely follows [YEDBack19]

Parameters:

reference_point_spec – this method is used to determine how the reference point is calculated. If a Callable function specified, it is expected to take existing posterior mean-based observations (to screen out the observation noise) and return a reference point with shape [D] (D represents number of objectives). If the Pareto front location is known, this arg can be used to specify a fixed reference point in each bo iteration. A dynamic reference point updating strategy is used by default to set a reference point according to the datasets.

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 hypervolume improvement acquisition 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 – The data from the observer. Must be populated.

batch_ehvi(sampler: trieste.models.ReparametrizationSampler[trieste.models.interfaces.HasReparamSampler], sampler_jitter: float, partition_bounds: tuple[trieste.types.TensorType, trieste.types.TensorType]) trieste.acquisition.interface.AcquisitionFunction[source]#
Parameters:
  • sampler – The posterior sampler, which given query points at, is able to sample the possible observations at ‘at’.

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

  • partition_bounds – with shape ([N, D], [N, D]), partitioned non-dominated hypercell bounds for hypervolume improvement calculation

Returns:

The batch expected hypervolume improvement acquisition function for objective minimisation.

class expected_hv_improvement(model: trieste.models.ProbabilisticModel, partition_bounds: tuple[trieste.types.TensorType, 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.

expected Hyper-volume (HV) calculating using Eq. 44 of [YEDBack19] paper. The expected hypervolume improvement calculation in the non-dominated region can be decomposed into sub-calculations based on each partitioned cell. For easier calculation, this sub-calculation can be reformulated as a combination of two generalized expected improvements, corresponding to Psi (Eq. 44) and Nu (Eq. 45) function calculations, respectively.

Note: 1. Since in Trieste we do not assume the use of a certain non-dominated region partition algorithm, we do not assume the last dimension of the partitioned cell has only one (lower) bound (i.e., minus infinity, which is used in the [YEDBack19] paper). This is not as efficient as the original paper, but is applicable to different non-dominated partition algorithm. 2. As the Psi and nu function in the original paper are defined for maximization problems, we inverse our minimisation problem (to also be a maximisation), allowing use of the original notation and equations.

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

  • partition_bounds – with shape ([N, D], [N, D]), partitioned non-dominated hypercell bounds for hypervolume improvement calculation

Returns:

The expected_hv_improvement acquisition function modified for objective minimisation. This function will raise ValueError or InvalidArgumentError if used with a batch size greater than one.

update(partition_bounds: tuple[trieste.types.TensorType, trieste.types.TensorType]) None[source]#

Update the acquisition function with new partition bounds.

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

Call acquisition function.

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.