def choose_next(self): """ sample a random config and give the least iterations """ next_config = sample_configuration(self.config_space, excluded_configs=self.bracket[0]['configs']) next_n_iteration = self.bracket[0]['n_iteration'] next_extra_conf = {} return next_config, next_n_iteration, next_extra_conf
def choose_next(self): """ sample a random config. give iterations according to Hyperband strategy. """ next_n_iteration = self.get_next_n_iteration() bracket_id = self.get_bracket_id(self.brackets, next_n_iteration) next_config = sample_configuration(self.config_space, excluded_configs=self.brackets[bracket_id][0]['configs']) next_extra_conf = {} return next_config, next_n_iteration, next_extra_conf
def choose_next(self): """ sample a config according to MFES. give iterations according to Hyperband strategy. """ next_config = None next_n_iteration = self.get_next_n_iteration() next_rung_id = self.get_rung_id(self.bracket, next_n_iteration) # Update weight when the inner loop of hyperband is finished if self.last_n_iteration != next_n_iteration and not self.use_bohb_strategy: if self.update_enable and self.weight_update_id > self.s_max: self.update_weight() self.weight_update_id += 1 self.last_n_iteration = next_n_iteration # sample config excluded_configs = self.bracket[next_rung_id]['configs'] if len(self.target_y[self.iterate_r[-1]]) == 0: next_config = sample_configuration( self.config_space, excluded_configs=excluded_configs) else: # Like BOHB, sample a fixed percentage of random configurations. self.random_check_idx += 1 if self.random_configuration_chooser.check(self.random_check_idx): next_config = sample_configuration( self.config_space, excluded_configs=excluded_configs) else: acq_configs = self.get_bo_candidates() for config in acq_configs: if config not in self.bracket[next_rung_id]['configs']: next_config = config break if next_config is None: self.logger.warning( 'Cannot get a non duplicate configuration from bo candidates. ' 'Sample a random one.') next_config = sample_configuration( self.config_space, excluded_configs=excluded_configs) next_extra_conf = {} return next_config, next_n_iteration, next_extra_conf