# smac.optimizer.acquisition module¶

class smac.optimizer.acquisition.AbstractAcquisitionFunction(model: smac.epm.base_epm.AbstractEPM)

Bases: object

Abstract base class for acquisition function

model
logger
_abc_impl = <_abc._abc_data object>
abstract _compute(X: numpy.ndarray) numpy.ndarray

Computes the acquisition value for a given point X. This function has to be overwritten in a derived class.

Parameters

X (np.ndarray) – The input points where the acquisition function should be evaluated. The dimensionality of X is (N, D), with N as the number of points to evaluate at and D is the number of dimensions of one X.

Returns

Acquisition function values wrt X

Return type

np.ndarray(N,1)

update(**kwargs: Any) None

Update the acquisition function attributes required for calculation.

This method will be called after fitting the model, but before maximizing the acquisition function. As an examples, EI uses it to update the current fmin.

The default implementation only updates the attributes of the acqusition function which are already present.

Parameters

kwargs

class smac.optimizer.acquisition.EI(model: smac.epm.base_epm.AbstractEPM, par: float = 0.0)

Computes for a given x the expected improvement as acquisition value.

$$EI(X) := \mathbb{E}\left[ \max\{0, f(\mathbf{X^+}) - f_{t+1}(\mathbf{X}) - \xi \} \right]$$, with $$f(X^+)$$ as the best location.

_abc_impl = <_abc._abc_data object>
_compute(X: numpy.ndarray) numpy.ndarray

Computes the EI value and its derivatives.

Parameters

X (np.ndarray(N, D), The input points where the acquisition function) – should be evaluated. The dimensionality of X is (N, D), with N as the number of points to evaluate at and D is the number of dimensions of one X.

Returns

Expected Improvement of X

Return type

np.ndarray(N,1)

class smac.optimizer.acquisition.EIPS(model: smac.epm.base_epm.AbstractEPM, par: float = 0.0)
_abc_impl = <_abc._abc_data object>
_compute(X: numpy.ndarray) numpy.ndarray

Computes the EIPS value.

Parameters

X (np.ndarray(N, D), The input point where the acquisition function) – should be evaluate. The dimensionality of X is (N, D), with N as the number of points to evaluate at and D is the number of dimensions of one X.

Returns

Expected Improvement per Second of X

Return type

np.ndarray(N,1)

class smac.optimizer.acquisition.IntegratedAcquisitionFunction(model: smac.epm.base_epm.AbstractEPM, acquisition_function: smac.optimizer.acquisition.AbstractAcquisitionFunction, **kwargs: Any)

Marginalize over Model hyperparameters to compute the integrated acquisition function.

See “Practical Bayesian Optimization of Machine Learning Algorithms” by Jasper Snoek et al. (https://papers.nips.cc/paper/4522-practical-bayesian-optimization-of-machine-learning-algorithms.pdf) for further details.

_abc_impl = <_abc._abc_data object>
_compute(X: numpy.ndarray) numpy.ndarray

Computes the EI value and its derivatives.

Parameters

X (np.ndarray(N, D), The input points where the acquisition function) – should be evaluated. The dimensionality of X is (N, D), with N as the number of points to evaluate at and D is the number of dimensions of one X.

Returns

Expected Improvement of X

Return type

np.ndarray(N,1)

update(**kwargs: Any) None

Update the acquisition functions values.

This method will be called if the model is updated. E.g. entropy search uses it to update its approximation of P(x=x_min), EI uses it to update the current fmin.

This implementation creates an acquisition function object for each model to integrate over and sets the respective attributes for each acquisition function object.

Parameters
• model (AbstractEPM) – The model needs to implement an additional attribute models which contains the different models to integrate over.

• kwargs

class smac.optimizer.acquisition.LCB(model: smac.epm.base_epm.AbstractEPM, par: float = 1.0)
_abc_impl = <_abc._abc_data object>
_compute(X: numpy.ndarray) numpy.ndarray

Computes the LCB value.

Parameters

X (np.ndarray(N, D)) – Points to evaluate LCB. N is the number of points and D the dimension for the points

Returns

Expected Improvement of X

Return type

np.ndarray(N,1)

class smac.optimizer.acquisition.LogEI(model: smac.epm.base_epm.AbstractEPM, par: float = 0.0)
_abc_impl = <_abc._abc_data object>
_compute(X: numpy.ndarray) numpy.ndarray

Computes the EI value and its derivatives.

Parameters

X (np.ndarray(N, D), The input points where the acquisition function) – should be evaluated. The dimensionality of X is (N, D), with N as the number of points to evaluate at and D is the number of dimensions of one X.

Returns

Expected Improvement of X

Return type

np.ndarray(N,1)

class smac.optimizer.acquisition.PI(model: smac.epm.base_epm.AbstractEPM, par: float = 0.0)
_abc_impl = <_abc._abc_data object>
_compute(X: numpy.ndarray) numpy.ndarray

Computes the PI value.

Parameters

X (np.ndarray(N, D)) – Points to evaluate PI. N is the number of points and D the dimension for the points

Returns

Expected Improvement of X

Return type

np.ndarray(N,1)

class smac.optimizer.acquisition.TS(model: smac.epm.base_epm.AbstractEPM, par: float = 0.0)
_abc_impl = <_abc._abc_data object>
_compute(X: numpy.ndarray) numpy.ndarray

Sample a new value from a gaussian distribution whose mean and covariance values are given by model :param X: Points to be evaluated where we could sample a value. N is the number of points and D the dimension

for the points

Returns

negative sample value of X

Return type

np.ndarray(N,1)