bayes_opt.acquisition

Acquisition functions for Bayesian Optimization.

The acquisition functions in this module can be grouped the following way:

  • One of the base acquisition functions (UpperConfidenceBound, ProbabilityOfImprovement and ExpectedImprovement) is always dictating the basic behavior of the suggestion step. They can be used alone or combined with a meta acquisition function.

  • GPHedge is a meta acquisition function that combines multiple base acquisition functions and determines the most suitable one for a particular problem.

  • ConstantLiar is a meta acquisition function that can be used for parallelized optimization and discourages sampling near a previously suggested, but not yet evaluated, point.

  • AcquisitionFunction is the base class for all acquisition functions. You can implement your own acquisition function by subclassing it. See the Acquisition Functions notebook to understand the many ways this class can be modified.

class bayes_opt.acquisition.AcquisitionFunction(random_state: int | RandomState | None = None) None

Base class for acquisition functions.

Parameters:
random_state : int, RandomState, default None

Set the random state for reproducibility.

abstract base_acq(*args: Any, **kwargs: Any) ndarray[Any, dtype[floating[Any]]]

Provide access to the base acquisition function.

Return type:

ndarray[Any, dtype[floating[Any]]]

Parameters:
args : Any

kwargs : Any

suggest(gp: GaussianProcessRegressor, target_space: TargetSpace, n_random: int = 10000, n_l_bfgs_b: int = 10, fit_gp: bool = True) ndarray[Any, dtype[floating[Any]]]

Suggest a promising point to probe next.

Parameters:
gp : GaussianProcessRegressor

A fitted Gaussian Process.

target_space : TargetSpace

The target space to probe.

n_random : int, default 10_000

Number of random samples to use.

n_l_bfgs_b : int, default 10

Number of starting points for the L-BFGS-B optimizer.

fit_gp : bool, default True

Whether to fit the Gaussian Process to the target space. Set to False if the GP is already fitted.

Return type:

ndarray[Any, dtype[floating[Any]]]

Returns:

np.ndarray – Suggested point to probe next.