# `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 (float or str, default 'max') – 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, default None) – Set the random state for reproducibility.

    - atol (float, default 1e-5) – Absolute tolerance to eliminate a dummy point.

    - rtol (float, default 1e-8) – Relative tolerance to eliminate a dummy point.

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

    Calculate the acquisition function.

    Calls the base acquisition function’s base_acq method.

    Return type:

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

    Returns:

      np.ndarray – Acquisition function value.

    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.