def _setup_search(self): # TODO: should be search space be a function or class? self._search_space = self._fixed_hp_config.copy() self._init_config = self._fixed_hp_config.copy() search_space = {'interactions': polynomial_expansion_set( init_monomials=set(self._raw_namespaces), highest_poly_order=len(self._raw_namespaces), allow_self_inter=False), } init_config = {'interactions': set()} self._search_space.update(search_space) self._init_config.update(init_config) logger.info('search space %s %s %s', self._search_space, self._init_config, self._fixed_hp_config)
def _setup_search(self): self._search_space = self._fixed_hp_config.copy() self._init_config = self._fixed_hp_config.copy() search_space = {'interactions': polynomial_expansion_set( init_monomials=set(self._raw_namespaces), highest_poly_order=len(self._raw_namespaces), allow_self_inter=False), 'learning_rate': loguniform(lower=2e-10, upper=1.0) } init_config = {'interactions': set(), 'learning_rate': 0.5} self._search_space.update(search_space) self._init_config.update(init_config) logger.info('search space %s %s %s', self._search_space, self._init_config, self._fixed_hp_config)
def _setup_search(self): self._search_space = self._fixed_hp_config.copy() self._init_config = self._fixed_hp_config.copy() search_space = { "interactions": polynomial_expansion_set( init_monomials=set(self._raw_namespaces), highest_poly_order=len(self._raw_namespaces), allow_self_inter=False, ), } init_config = {"interactions": set()} self._search_space.update(search_space) self._init_config.update(init_config) logger.info( "search space %s %s %s", self._search_space, self._init_config, self._fixed_hp_config, )
def _setup_trial_runner(self, vw_example): """Set up the _trial_runner based on one vw_example.""" # setup the default search space for the namespace interaction hyperparameter search_space = self._search_space.copy() for k, v in self._search_space.items(): if k == self.VW_INTERACTION_ARG_NAME and v == self.AUTOMATIC: raw_namespaces = self.get_ns_feature_dim_from_vw_example( vw_example ).keys() search_space[k] = polynomial_expansion_set( init_monomials=set(raw_namespaces) ) # setup the init config based on the input _init_config and search space init_config = self._init_config.copy() for k, v in search_space.items(): if k not in init_config.keys(): if isinstance(v, PolynomialExpansionSet): init_config[k] = set() elif not isinstance(v, Categorical) and not isinstance(v, Float): init_config[k] = v searcher_args = { "init_config": init_config, "space": search_space, "random_seed": self._random_seed, "online_trial_args": self._online_trial_args, } logger.info("original search_space %s", self._search_space) logger.info("original init_config %s", self._init_config) logger.info("searcher_args %s", searcher_args) logger.info("scheduler_args %s", self._scheduler_args) logger.info("automl_runner_args %s", self._automl_runner_args) searcher = ChampionFrontierSearcher(**searcher_args) scheduler = ChaChaScheduler(**self._scheduler_args) self._trial_runner = OnlineTrialRunner( max_live_model_num=self._max_live_model_num, searcher=searcher, scheduler=scheduler, **self._automl_runner_args )