diff --git a/optuna_dashboard/_app.py b/optuna_dashboard/_app.py index 731de524..87efaae5 100644 --- a/optuna_dashboard/_app.py +++ b/optuna_dashboard/_app.py @@ -221,10 +221,8 @@ def create_app( ) = get_cached_extra_study_property(study_id, trials) plotly_graph_objects = get_plotly_graph_objects(system_attrs) - trials_id2number = {trial._trial_id: trial.number for trial in trials} - skipped_trials = [ - trials_id2number[trial_id] for trial_id in get_skipped_trial_ids(system_attrs) - ] + skipped_trial_ids = get_skipped_trial_ids(system_attrs) + skipped_trials = [t.number for t in trials if t._trial_id in skipped_trial_ids] return serialize_study_detail( summary, best_trials, diff --git a/optuna_dashboard/_serializer.py b/optuna_dashboard/_serializer.py index d3cd786f..af3ed242 100644 --- a/optuna_dashboard/_serializer.py +++ b/optuna_dashboard/_serializer.py @@ -167,7 +167,7 @@ def serialize_study_detail( if serialized["is_preferential"]: serialized["preference_history"] = serialize_preference_history(system_attrs) serialized["preferences"] = get_preferences(system_attrs) - serialized["skipped_trials"] = skipped_trials + serialized["skipped_trial_numbers"] = skipped_trials serialized["plotly_graph_objects"] = [ {"id": id_, "graph_object": graph_object} for id_, graph_object in plotly_graph_objects.items() diff --git a/optuna_dashboard/ts/apiClient.ts b/optuna_dashboard/ts/apiClient.ts index abfe057a..9f9cd8cb 100644 --- a/optuna_dashboard/ts/apiClient.ts +++ b/optuna_dashboard/ts/apiClient.ts @@ -99,7 +99,7 @@ interface StudyDetailResponse { preferences?: [number, number][] preference_history?: PreferenceHistoryResponce[] plotly_graph_objects: PlotlyGraphObject[] - skipped_trials?: number[] + skipped_trial_numbers?: number[] } export const getStudyDetailAPI = ( @@ -140,7 +140,7 @@ export const getStudyDetailAPI = ( convertPreferenceHistory ), plotly_graph_objects: res.data.plotly_graph_objects, - skipped_trials: res.data.skipped_trials ?? [], + skipped_trial_numbers: res.data.skipped_trial_numbers ?? [], } }) } diff --git a/optuna_dashboard/ts/components/PreferentialTrials.tsx b/optuna_dashboard/ts/components/PreferentialTrials.tsx index 26cc4976..5fc0ac32 100644 --- a/optuna_dashboard/ts/components/PreferentialTrials.tsx +++ b/optuna_dashboard/ts/components/PreferentialTrials.tsx @@ -198,7 +198,7 @@ export const PreferentialTrials: FC<{ studyDetail: StudyDetail | null }> = ({ studyDetail.preference_history ?.filter((h) => !h.is_removed) .map((p) => p.clicked) - .concat(studyDetail.skipped_trials) ?? [] + .concat(studyDetail.skipped_trial_numbers) ?? [] ) const activeTrials = studyDetail.trials.filter( (t) => diff --git a/optuna_dashboard/ts/types/index.d.ts b/optuna_dashboard/ts/types/index.d.ts index 01868f7b..a51a88d9 100644 --- a/optuna_dashboard/ts/types/index.d.ts +++ b/optuna_dashboard/ts/types/index.d.ts @@ -206,7 +206,7 @@ type StudyDetail = { preferences?: [number, number][] preference_history?: PreferenceHistory[] plotly_graph_objects: PlotlyGraphObject[] - skipped_trials: number[] + skipped_trial_numbers: number[] } type StudyDetails = {