def suggest(self, num=1): """Suggest a `num`ber of new sets of parameters. TODO: document how suggest work for this algo """ # Make a copy so that all sampled trials are lost afterwards. The will be observed with fake # results anyway, so they will be re-introduced in the algo before the next call to # `suggest`. We only copy the storage however, otherwise the RNG stote increment inside the # samplers would lost. storage = self.study._storage self.study._storage = copy.deepcopy(storage) points = [] for i in range(num): trial_id = self.study.storage.create_new_trial(self.study.study_id) trial = optuna.trial.Trial(self.study, trial_id) params = [] for param_name, _ in iterdims(self.space): distribution = self.dimensions[param_name] params.append(trial._suggest(param_name, distribution)) points.append(pack_point(params, self.space)) self.study._storage = storage return points
def suggest(self, num=1): """Suggest a `num`ber of new sets of parameters. Perform a step towards negative gradient and suggest that point. """ self._init_optimizer() points = self.optimizer.ask(n_points=num, strategy=self.strategy) return [pack_point(point, self.space) for point in points]
def suggest(self, num=1): """Suggest a `num`ber of new sets of parameters. Perform a step towards negative gradient and suggest that point. """ if num > 1: raise AttributeError("BayesianOptimizer does not support num > 1.") points = [self.optimizer._ask()] # pylint: disable = protected-access return [pack_point(point, self.space) for point in points]