a75735ba73983c48638bbe52d77997f24075a043,optuna/storages/_base.py,BaseStorage,get_best_trial,#BaseStorage#Any#,564
Before Change
if len(all_trials) == 0:
raise ValueError("No trials are completed yet.")
if self.get_study_direction(study_id) == StudyDirection.MAXIMIZE:
best_trial = max(all_trials, key=lambda t: t.value)
else:
best_trial = min(all_trials, key=lambda t: t.value)
After Change
if len(all_trials) == 0:
raise ValueError("No trials are completed yet.")
direction = self.get_study_direction(study_id)
if len(direction) > 1:
raise ValueError("Best trial can be obtained only for single-objective optimization.")
direction = direction[0]
if direction == StudyDirection.MAXIMIZE:
best_trial = max(all_trials, key=lambda t: t.value)
else:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances
Project Name: pfnet/optuna
Commit Name: a75735ba73983c48638bbe52d77997f24075a043
Time: 2020-11-04
Author: imamura@ms.k.u-tokyo.ac.jp
File Name: optuna/storages/_base.py
Class Name: BaseStorage
Method Name: get_best_trial
Project Name: pfnet/optuna
Commit Name: a75735ba73983c48638bbe52d77997f24075a043
Time: 2020-11-04
Author: imamura@ms.k.u-tokyo.ac.jp
File Name: optuna/storages/_rdb/storage.py
Class Name: RDBStorage
Method Name: get_best_trial
Project Name: pfnet/optuna
Commit Name: a75735ba73983c48638bbe52d77997f24075a043
Time: 2020-11-04
Author: imamura@ms.k.u-tokyo.ac.jp
File Name: optuna/storages/_redis.py
Class Name: RedisStorage
Method Name: get_best_trial