bayes_opt.BayesianOptimization
¶
-
class bayes_opt.BayesianOptimization(f, pbounds, constraint=
None
, random_state=None
, verbose=2
, bounds_transformer=None
, allow_duplicate_points=False
)¶ Handle optimization of a target function over a specific target space.
This class takes the function to optimize as well as the parameters bounds in order to find which values for the parameters yield the maximum value using bayesian optimization.
- Parameters:¶
- f : function¶
Function to be maximized.
- pbounds : dict¶
Dictionary with parameters names as keys and a tuple with minimum and maximum values.
- constraint : ConstraintModel¶
Note that the names of arguments of the constraint function and of f need to be the same.
- random_state : int or numpy.random.RandomState, optional(default=None)¶
If the value is an integer, it is used as the seed for creating a numpy.random.RandomState. Otherwise the random state provided is used. When set to None, an unseeded random state is generated.
- verbose : int, optional(default=2)¶
The level of verbosity.
- bounds_transformer : DomainTransformer, optional(default=None)¶
If provided, the transformation is applied to the bounds.
- allow_duplicate_points : bool, optional (default=False)¶
If True, the optimizer will allow duplicate points to be registered. This behavior may be desired in high noise situations where repeatedly probing the same point will give different answers. In other situations, the acquisition may occasionally generate a duplicate point.
- property constraint¶
Return the constraint associated with the optimizer, if any.
- property max¶
Get maximum target value found and corresponding parameters.
See TargetSpace.max for more information.
-
maximize(init_points=
5
, n_iter=25
, acquisition_function=None
, acq=None
, kappa=None
, kappa_decay=None
, kappa_decay_delay=None
, xi=None
, **gp_params)¶ Maximize the given function over the target space.
- Parameters:¶
- init_points : int, optional(default=5)¶
Number of iterations before the explorations starts the exploration for the maximum.
- n_iter : int, optional(default=25)¶
Number of iterations where the method attempts to find the maximum value.
- acquisition_function : object, optional¶
An instance of bayes_opt.util.UtilityFunction. If nothing is passed, a default using ucb is used
- acq=
None
¶ Deprecated, unused and slated for deletion.
- kappa=
None
¶ Deprecated, unused and slated for deletion.
- kappa_decay=
None
¶ Deprecated, unused and slated for deletion.
- kappa_decay_delay=
None
¶ Deprecated, unused and slated for deletion.
- xi=
None
¶ Deprecated, unused and slated for deletion.
- **gp_params
Deprecated, unused and slated for deletion.
-
register(params, target, constraint_value=
None
)¶ Register an observation with known target.
- property res¶
Get all target values and constraint fulfillment for all parameters.
See TargetSpace.res for more information.
- set_bounds(new_bounds)¶
Modify the bounds of the search space.
- property space¶
Return the target space associated with the optimizer.
- suggest(utility_function)¶
Suggest a promising point to probe next.