From 9f1eb6e05719d8ecf073a7f973bdc5a0afd1bd2d Mon Sep 17 00:00:00 2001 From: c-bata Date: Mon, 19 Aug 2024 21:05:32 +0900 Subject: [PATCH] Rename objective_names to metric_names --- optuna_dashboard/ts/apiClient.ts | 1 + optuna_dashboard/ts/axiosClient.ts | 2 +- optuna_dashboard/ts/components/GraphContour.tsx | 6 +++--- optuna_dashboard/ts/components/GraphHistory.tsx | 10 +++++----- optuna_dashboard/ts/components/GraphParetoFront.tsx | 10 +++++----- optuna_dashboard/ts/components/GraphRank.tsx | 6 +++--- .../ts/components/Preferential/PreferentialHistory.tsx | 2 +- .../ts/components/Preferential/PreferentialTrials.tsx | 2 +- optuna_dashboard/ts/components/TrialFormWidgets.tsx | 8 ++++---- optuna_dashboard/ts/components/TrialList.tsx | 8 ++++---- optuna_dashboard/ts/components/TrialTable.tsx | 6 +++--- optuna_dashboard/ts/types/optuna.ts | 2 +- 12 files changed, 32 insertions(+), 31 deletions(-) diff --git a/optuna_dashboard/ts/apiClient.ts b/optuna_dashboard/ts/apiClient.ts index 0afd5869..f0edc228 100644 --- a/optuna_dashboard/ts/apiClient.ts +++ b/optuna_dashboard/ts/apiClient.ts @@ -65,6 +65,7 @@ export interface StudyDetailResponse { has_intermediate_values: boolean note: Note is_preferential: boolean + // TODO(c-bata): Rename this to metric_names after releasing the new Jupyter Lab extension. objective_names?: string[] form_widgets?: FormWidgets preferences?: [number, number][] diff --git a/optuna_dashboard/ts/axiosClient.ts b/optuna_dashboard/ts/axiosClient.ts index dd68d779..851ba494 100644 --- a/optuna_dashboard/ts/axiosClient.ts +++ b/optuna_dashboard/ts/axiosClient.ts @@ -62,7 +62,7 @@ export class AxiosClient extends APIClient { union_user_attrs: res.data.union_user_attrs, has_intermediate_values: res.data.has_intermediate_values, note: res.data.note, - objective_names: res.data.objective_names, + metric_names: res.data.objective_names, form_widgets: res.data.form_widgets, is_preferential: res.data.is_preferential, feedback_component_type: res.data.feedback_component_type, diff --git a/optuna_dashboard/ts/components/GraphContour.tsx b/optuna_dashboard/ts/components/GraphContour.tsx index 76191ce8..ade974b6 100644 --- a/optuna_dashboard/ts/components/GraphContour.tsx +++ b/optuna_dashboard/ts/components/GraphContour.tsx @@ -130,7 +130,7 @@ const ContourFrontend: FC<{ const searchSpace = useMergedUnionSearchSpace(study?.union_search_space) const [xParam, setXParam] = useState(null) const [yParam, setYParam] = useState(null) - const objectiveNames: string[] = study?.objective_names || [] + const metricNames: string[] = study?.metric_names || [] if (xParam === null && searchSpace.length > 0) { setXParam(searchSpace[0]) @@ -182,8 +182,8 @@ const ContourFrontend: FC<{ @@ -253,7 +253,7 @@ const plotHistory = ( b: 0, }, yaxis: { - title: target.toLabel(historyPlotInfos[0].objective_names), + title: target.toLabel(historyPlotInfos[0].metric_names), type: logScale ? "log" : "linear", }, xaxis: { @@ -293,7 +293,7 @@ const plotHistory = ( y: feasibleTrials.map( (t: Optuna.Trial): number => target.getTargetValue(t) as number ), - name: `${target.toLabel(h.objective_names)} of ${h.study_name}`, + name: `${target.toLabel(h.metric_names)} of ${h.study_name}`, marker: { size: markerSize, }, diff --git a/optuna_dashboard/ts/components/GraphParetoFront.tsx b/optuna_dashboard/ts/components/GraphParetoFront.tsx index 41444ed5..3f8214ca 100644 --- a/optuna_dashboard/ts/components/GraphParetoFront.tsx +++ b/optuna_dashboard/ts/components/GraphParetoFront.tsx @@ -69,7 +69,7 @@ const GraphParetoFrontFrontend: FC<{ const navigate = useNavigate() const [objectiveXId, setObjectiveXId] = useState(0) const [objectiveYId, setObjectiveYId] = useState(1) - const objectiveNames: string[] = study?.objective_names || [] + const metricNames: string[] = study?.metric_names || [] const handleObjectiveXChange = (event: SelectChangeEvent) => { setObjectiveXId(event.target.value as number) @@ -130,8 +130,8 @@ const GraphParetoFrontFrontend: FC<{ {study.directions.map((d, i) => ( - {objectiveNames.length === study?.directions.length - ? objectiveNames[i] + {metricNames.length === study?.directions.length + ? metricNames[i] : `${i}`} ))} diff --git a/optuna_dashboard/ts/components/GraphRank.tsx b/optuna_dashboard/ts/components/GraphRank.tsx index bf3c0711..c8b55a42 100644 --- a/optuna_dashboard/ts/components/GraphRank.tsx +++ b/optuna_dashboard/ts/components/GraphRank.tsx @@ -91,7 +91,7 @@ const GraphRankFrontend: FC<{ const searchSpace = useMergedUnionSearchSpace(study?.union_search_space) const [xParam, setXParam] = useState(null) const [yParam, setYParam] = useState(null) - const objectiveNames: string[] = study?.objective_names || [] + const metricNames: string[] = study?.metric_names || [] if (xParam === null && searchSpace.length > 0) { setXParam(searchSpace[0]) @@ -150,8 +150,8 @@ const GraphRankFrontend: FC<{