def observe(self, points, results): """Observe evaluation `results` corresponding to list of `points` in space. TODO: document how observe work for this algo """ for point, result in zip(points, results): params = unpack_point(point, self.space) # Create a trial trial_id = self.study.storage.create_new_trial(self.study.study_id) trial = optuna.trial.Trial(self.study, trial_id) # Set the params for i, (param_name, _) in enumerate(iterdims(self.space)): distribution = self.dimensions[param_name] param_value_internal = distribution.to_internal_repr(params[i]) self.study.storage.set_trial_param(trial_id, param_name, param_value_internal, distribution) # Report the objective trial.report(result['objective']) self.study.storage.set_trial_state( trial_id, optuna.structs.TrialState.COMPLETE)
def observe(self, points, results): """Observe evaluation `results` corresponding to list of `points` in space. Save current point and gradient corresponding to this point. """ self.optimizer.tell( [unpack_point(point, self.space) for point in points], [r['objective'] for r in results])