bayes_opt.acquisition.ConstantLiar¶
- class bayes_opt.acquisition.ConstantLiar(base_acquisition: AcquisitionFunction, strategy: Literal['min', 'mean', 'max'] | float = 'max', random_state: int | RandomState | None = None, atol: float = 1e-05, rtol: float = 1e-08) None¶
Constant Liar acquisition function.
Used for asynchronous optimization. It operates on a copy of the target space that includes the previously suggested points that have not been evaluated yet. A GP fitted to this target space is less likely to suggest the same point again, since the variance of the predictive distribution is lower at these points. This is discourages the optimization algorithm from suggesting the same point to multiple workers.
- Parameters:
base_acquisition (
AcquisitionFunction) – The acquisition function to use.strategy (
Literal['min','mean','max'] |float) – Strategy to use for the constant liar. If a float, the constant liar will always register dummies with this value. If ‘min’/’mean’/’max’, the constant liar will register dummies with the minimum/mean/maximum target value in the target space.random_state (
int|RandomState|None) – Set the random state for reproducibility.atol (
float) – Absolute tolerance to eliminate a dummy point.rtol (
float) – Relative tolerance to eliminate a dummy point.
- base_acq(*args: Any, **kwargs: Any) ndarray[tuple[Any, ...], dtype[floating[Any]]]¶
Calculate the acquisition function.
Calls the base acquisition function’s base_acq method.
- Return type:
ndarray[tuple[Any,...],dtype[floating[Any]]]- Returns:
np.ndarray – Acquisition function value.
- Parameters:
args (Any)
kwargs (Any)
- get_acquisition_params() dict[str, Any]¶
Get the current acquisition function parameters.
- Return type:
dict[str,Any]- Returns:
dict – Dictionary containing the current acquisition function parameters.
- set_acquisition_params(params: dict[str, Any]) None¶
Set the acquisition function parameters.
- Parameters:
params (
dict[str,Any]) – Dictionary containing the acquisition function parameters.- Return type:
None
- suggest(gp: GaussianProcessRegressor, target_space: TargetSpace, n_random: int = 10000, n_smart: int = 10, fit_gp: bool = True, random_state: int | RandomState | None = None) ndarray[tuple[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) – Number of random samples to use.n_smart (
int) – Number of starting points for the L-BFGS-B optimizer.fit_gp (
bool) – Unused, since the GP is always fitted to the dummy target space. Remains for compatibility with the base class.random_state (
int|RandomState|None) – Random state to use for the optimization.
- Return type:
ndarray[tuple[Any,...],dtype[floating[Any]]]- Returns:
np.ndarray – Suggested point to probe next.