def __init__(self, api_config, **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. """ AbstractOptimizer.__init__(self, api_config) self.opt1 = PySOTOptimizer(api_config, **kwargs) self.opt2 = OpentunerOptimizer(api_config)
class OpenPySOTOptimizer(AbstractOptimizer): def __init__(self, api_config, **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. """ AbstractOptimizer.__init__(self, api_config) self.opt1 = PySOTOptimizer(api_config, **kwargs) self.opt2 = OpentunerOptimizer(api_config) def suggest(self, n_suggestions=1): t_out = self.opt1.suggest(n_suggestions) s_out = self.opt2.suggest(n_suggestions) N = len(t_out) // 2 return t_out[:N] + s_out[N:] def observe(self, X, y): self.opt1.observe(X, y) self.opt2.observe(X, y)