emukit.core.acquisition package

Submodules

class emukit.core.acquisition.acquisition.Acquisition

Bases: ABC

Acquisition base class

abstract evaluate(x)

Abstract method. Evaluates the acquisition function.

Parameters

x (ndarray) – (n_points x n_dims) array of points at which to calculate acquisition function values

Return type

ndarray

Returns

(n_points x 1) array of acquisition function values

abstract property has_gradients: bool

Abstract property. Whether acquisition value has analytical gradient calculation available.

Return type

bool

Returns

True if gradients are available

evaluate_with_gradients(x)

Optional abstract method that must be implemented if has_gradients returns True. Evaluates value and gradient of acquisition function at x.

Parameters

x (ndarray) – (n_points x n_dims) array of points at which to calculate acquisition function values and gradient

Return type

Tuple[ndarray, ndarray]

Returns

Tuple contains an (n_points x 1) array of acquisition function values and (n_points x n_dims) array of acquisition function gradients with respect to x

update_parameters()

Performs any updates to parameters that needs to be done once per outer loop iteration

Return type

None

class emukit.core.acquisition.acquisition.Quotient(numerator, denominator)

Bases: Acquisition

Acquisition for division of two acquisition functions

evaluate(x)

Evaluate division of the two acquisition functions

Parameters

x (ndarray) – (n_points x n_dims) array of points at which to calculate acquisition function values

Return type

ndarray

Returns

(n_points x 1) array of acquisition function values

evaluate_with_gradients(x)

Evaluate value and gradient of acquisition function at x

Parameters

x (ndarray) – (n_points x n_dims) array of points at which to calculate acquisition function values and gradient

Return type

Tuple[ndarray, ndarray]

Returns

Tuple contains an (n_points x 1) array of acquisition function values and (n_points x n_dims) array of acquisition function gradients with respect to x

property has_gradients: bool

Whether acquisition value has analytical gradient calculation available.

Return type

bool

Returns

True if gradients are available

update_parameters()

Performs any updates to parameters that needs to be done once per outer loop iteration

Return type

None

class emukit.core.acquisition.acquisition.Product(acquisition_1, acquisition_2)

Bases: Acquisition

Acquisition for product of two or more acquisition functions

evaluate(x)

Evaluate product of the two acquisition functions

Parameters

x (ndarray) – (n_points x n_dims) array of points at which to calculate acquisition function values

Return type

ndarray

Returns

(n_points x 1) array of acquisition function values

evaluate_with_gradients(x)

Evaluate value and gradient of acquisition function at x

Parameters

x (ndarray) – (n_points x n_dims) array of points at which to calculate acquisition function values and gradient

Return type

Tuple[ndarray, ndarray]

Returns

Tuple contains an (n_points x 1) array of acquisition function values and (n_points x n_dims) array of acquisition function gradients with respect to x

property has_gradients

Whether acquisition value has analytical gradient calculation available.

Returns

True if gradients are available

update_parameters()

Performs any updates to parameters that needs to be done once per outer loop iteration

Return type

None

class emukit.core.acquisition.acquisition.Sum(acquisition_1, acquisition_2)

Bases: Acquisition

Acquisition for sum of two acquisition functions

evaluate(x)

Evaluate sum of the two acquisition functions

Parameters

x (ndarray) – (n_points x n_dims) array of points at which to calculate acquisition function values

Return type

ndarray

Returns

(n_points x 1) array of acquisition function values

evaluate_with_gradients(x)

Evaluate value and gradient of acquisition function at x

Parameters

x (ndarray) – (n_points x n_dims) array of points at which to calculate acquisition function values and gradient

Return type

Tuple[ndarray, ndarray]

Returns

Tuple contains an (n_points x 1) array of acquisition function values and (n_points x n_dims) array of acquisition function gradients with respect to x

property has_gradients

Whether acquisition value has analytical gradient calculation available.

Returns

True if gradients are available

update_parameters()

Performs any updates to parameters that needs to be done once per outer loop iteration

Return type

None

emukit.core.acquisition.acquisition_per_cost.acquisition_per_expected_cost(acquisition, cost_model, min_cost=0.0001)

Creates an acquisition function that is the original acquisition scaled by the expected value of the evaluation cost of the user function.

Parameters
  • acquisition (Acquisition) – Base acquisition function

  • cost_model (IModel) – Model of the evaluation cost. Should return positive values only.

Return type

Acquisition

Returns

Scaled acquisition function

class emukit.core.acquisition.acquisition_per_cost.CostAcquisition(cost_model, min_cost=0.0001)

Bases: Acquisition

Acquisition that simply returns the expected value from the cost model

evaluate(x)

Evaluate acquisition function

Parameters

x (ndarray) – A numpy array of shape (n_inputs x n_input_features) containing input locations at which to evaluate the cost

Return type

ndarray

Returns

Value of expected cost at input locations

property has_gradients: bool

Whether gradients of the cost function with respect to input location are available

Return type

bool

evaluate_with_gradients(x)
Parameters

x (ndarray) – A numpy array of shape (n_inputs x n_input_features) containing input locations at which to evaluate the cost

Return type

Tuple[ndarray, ndarray]

Returns

Tuple of numpy arrays: (cost value, cost gradients)

class emukit.core.acquisition.integrated_acquisition.IntegratedHyperParameterAcquisition(model, acquisition_generator, n_samples=10, n_burnin=100, subsample_interval=10, step_size=0.1, leapfrog_steps=20)

Bases: Acquisition

This acquisition class provides functionality for integrating any acquisition function over model hyper-parameters

evaluate(x)

Evaluate acquisition by integrating over the hyper-parameters of the model :type x: ndarray :param x: locations where the evaluation is done. :rtype: ndarray :return: Array with integrated acquisition value at all input locations

evaluate_with_gradients(x)

Computes the acquisition value and its derivative integrating over the hyper-parameters of the model

Parameters

x (ndarray) – locations where the evaluation with gradients is done.

Return type

Tuple

Returns

tuple containing the integrated expected improvement at the points x and its gradient.

update_parameters()

Performs any updates to parameters that needs to be done once per outer loop iteration

property has_gradients: bool

Returns that this acquisition has gradients

Return type

bool

update_batches(x_batch, lipschitz_constant, f_min)

Module contents