in bayesmark/builtin_opt/scikit_optimizer.py [0:0]
def __init__(self, api_config, base_estimator="GP", acq_func="gp_hedge", n_initial_points=5, **kwargs):
"""Build wrapper class to use an optimizer in benchmark.
Parameters
----------
api_config : dict-like of dict-like
Configuration of the optimization variables. See API description.
base_estimator : {'GP', 'RF', 'ET', 'GBRT'}
How to estimate the objective function.
acq_func : {'LCB', 'EI', 'PI', 'gp_hedge', 'EIps', 'PIps'}
Acquisition objective to decide next suggestion.
n_initial_points : int
Number of points to sample randomly before actual Bayes opt.
"""
AbstractOptimizer.__init__(self, api_config)
dimensions, self.round_to_values = ScikitOptimizer.get_sk_dimensions(api_config)
# Older versions of skopt don't copy over the dimensions names during
# normalization and hence the names are missing in
# self.skopt.space.dimensions. Therefore, we save our own copy of
# dimensions list to be safe. If we can commit to using the newer
# versions of skopt we can delete self.dimensions.
self.dimensions_list = tuple(dd.name for dd in dimensions)
# Undecided where we want to pass the kwargs, so for now just make sure
# they are blank
assert len(kwargs) == 0
self.skopt = SkOpt(
dimensions,
n_initial_points=n_initial_points,
base_estimator=base_estimator,
acq_func=acq_func,
acq_optimizer="auto",
acq_func_kwargs={},
acq_optimizer_kwargs={},
)