From e2ae366ded96608fa53918bce6b3a4c2db27851b Mon Sep 17 00:00:00 2001 From: contramundum53 Date: Thu, 22 Jun 2023 15:55:12 +0900 Subject: [PATCH 1/2] Fix check for single-objective study --- optuna_dashboard/_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optuna_dashboard/_app.py b/optuna_dashboard/_app.py index 24cc82be..ede64197 100644 --- a/optuna_dashboard/_app.py +++ b/optuna_dashboard/_app.py @@ -186,7 +186,7 @@ def create_app( trials = get_trials(storage, study_id) # TODO(c-bata): Cache best_trials - if summary.directions == 1: + if len(summary.directions) == 1: best_trials = [storage.get_best_trial(study_id)] else: best_trials = get_pareto_front_trials(trials=trials, directions=summary.directions) From 74f1b7cc73a60735f73085798cb5ebb25760ecbd Mon Sep 17 00:00:00 2001 From: contramundum53 Date: Thu, 22 Jun 2023 18:27:27 +0900 Subject: [PATCH 2/2] 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) (