From 74f1b7cc73a60735f73085798cb5ebb25760ecbd Mon Sep 17 00:00:00 2001 From: contramundum53 Date: Thu, 22 Jun 2023 18:27:27 +0900 Subject: [PATCH] Fix bug when there is zero trial in the study. --- optuna_dashboard/_app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/optuna_dashboard/_app.py b/optuna_dashboard/_app.py index ede64197..9b9de57d 100644 --- a/optuna_dashboard/_app.py +++ b/optuna_dashboard/_app.py @@ -187,7 +187,10 @@ def create_app( # TODO(c-bata): Cache best_trials if len(summary.directions) == 1: - best_trials = [storage.get_best_trial(study_id)] + if len([t for t in trials if t.state == TrialState.COMPLETE]) == 0: + best_trials = [] + else: + best_trials = [storage.get_best_trial(study_id)] else: best_trials = get_pareto_front_trials(trials=trials, directions=summary.directions) (