From 702f8d1c896f8c049f0153547ccf4dc2884bcf8d Mon Sep 17 00:00:00 2001 From: c-bata Date: Thu, 21 Apr 2022 11:26:44 +0900 Subject: [PATCH] Fix bug of pareto front graph --- optuna_dashboard/ts/components/GraphParetoFront.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/optuna_dashboard/ts/components/GraphParetoFront.tsx b/optuna_dashboard/ts/components/GraphParetoFront.tsx index b195c9e9..48a8d56c 100644 --- a/optuna_dashboard/ts/components/GraphParetoFront.tsx +++ b/optuna_dashboard/ts/components/GraphParetoFront.tsx @@ -85,8 +85,13 @@ export const GraphParetoFront: FC<{ ) } -const filterFunc = (trial: Trial): boolean => { - return trial.state !== "Complete" || trial.values!.every((v) => v !== "inf") +const filterFunc = (trial: Trial, directions: StudyDirection[]): boolean => { + return ( + trial.state === "Complete" && + trial.values !== undefined && + trial.values.length === directions.length && + trial.values.every((v) => v !== "inf") + ) } const plotParetoFront = ( @@ -110,7 +115,9 @@ const plotParetoFront = ( } const trials: Trial[] = study ? study.trials : [] - const filteredTrials = trials.filter(filterFunc) + const filteredTrials = trials.filter((t: Trial) => + filterFunc(t, study.directions) + ) if (filteredTrials.length === 0) { plotly.react(plotDomId, [], layout)