From 2836969a9fd036501135f4393ce6cff5986d3ea2 Mon Sep 17 00:00:00 2001 From: porink0424 Date: Fri, 12 Apr 2024 18:16:32 +0900 Subject: [PATCH] Apply formatter --- optuna_dashboard/ts/action.ts | 5 +++- .../ts/components/CreateStudyDialog.tsx | 9 ++++-- .../ts/components/GraphContour.tsx | 5 +--- .../ts/components/GraphParallelCoordinate.tsx | 4 ++- .../ts/components/GraphParetoFront.tsx | 5 +++- optuna_dashboard/ts/components/GraphSlice.tsx | 4 ++- .../ts/components/StudyHistory.tsx | 5 +++- .../ts/components/TrialFormWidgets.tsx | 6 ++-- optuna_dashboard/ts/components/TrialList.tsx | 29 ++++++++++++------- optuna_dashboard/ts/dominatedTrials.ts | 5 +++- optuna_dashboard/ts/trialFilter.ts | 5 +++- 11 files changed, 55 insertions(+), 27 deletions(-) diff --git a/optuna_dashboard/ts/action.ts b/optuna_dashboard/ts/action.ts index 663c0022..d906d1c5 100644 --- a/optuna_dashboard/ts/action.ts +++ b/optuna_dashboard/ts/action.ts @@ -271,7 +271,10 @@ export const actionCreator = () => { }) } - const createNewStudy = (studyName: string, directions: Optuna.StudyDirection[]) => { + const createNewStudy = ( + studyName: string, + directions: Optuna.StudyDirection[] + ) => { createNewStudyAPI(studyName, directions) .then((study_summary) => { const newVal = [...studySummaries, study_summary] diff --git a/optuna_dashboard/ts/components/CreateStudyDialog.tsx b/optuna_dashboard/ts/components/CreateStudyDialog.tsx index 88ec11b0..8e7ee3bf 100644 --- a/optuna_dashboard/ts/components/CreateStudyDialog.tsx +++ b/optuna_dashboard/ts/components/CreateStudyDialog.tsx @@ -26,7 +26,9 @@ export const useCreateStudyDialog = (): [() => void, () => ReactNode] => { const [newStudyName, setNewStudyName] = useState("") const [openNewStudyDialog, setOpenNewStudyDialog] = useState(false) - const [directions, setDirections] = useState(["minimize"]) + const [directions, setDirections] = useState([ + "minimize", + ]) const studies = useRecoilValue(studySummariesState) const newStudyNameAlreadyUsed = studies.some( (v) => v.study_name === newStudyName @@ -104,7 +106,10 @@ export const useCreateStudyDialog = (): [() => void, () => ReactNode] => { startIcon={} sx={{ marginRight: theme.spacing(1) }} onClick={() => { - const newVal: Optuna.StudyDirection[] = [...directions, "minimize"] + const newVal: Optuna.StudyDirection[] = [ + ...directions, + "minimize", + ] setDirections(newVal) }} > diff --git a/optuna_dashboard/ts/components/GraphContour.tsx b/optuna_dashboard/ts/components/GraphContour.tsx index 75524483..5f6936a5 100644 --- a/optuna_dashboard/ts/components/GraphContour.tsx +++ b/optuna_dashboard/ts/components/GraphContour.tsx @@ -207,10 +207,7 @@ const ContourFrontend: FC<{ } const filterFunc = (trial: Trial, objectiveId: number): boolean => { - return ( - trial.state === "Complete" && - trial.values !== undefined - ) + return trial.state === "Complete" && trial.values !== undefined } const plotContour = ( diff --git a/optuna_dashboard/ts/components/GraphParallelCoordinate.tsx b/optuna_dashboard/ts/components/GraphParallelCoordinate.tsx index 417a2807..10c1eed5 100644 --- a/optuna_dashboard/ts/components/GraphParallelCoordinate.tsx +++ b/optuna_dashboard/ts/components/GraphParallelCoordinate.tsx @@ -246,7 +246,9 @@ const plotCoordinate = ( ) if (s.distribution.type === "CategoricalDistribution") { // categorical - const vocabArr: string[] = s.distribution.choices.map((c) => c?.toString() ?? "null") + const vocabArr: string[] = s.distribution.choices.map( + (c) => c?.toString() ?? "null" + ) const tickvals: number[] = vocabArr.map((v, i) => i) return { label: breakLabelIfTooLong(s.name), diff --git a/optuna_dashboard/ts/components/GraphParetoFront.tsx b/optuna_dashboard/ts/components/GraphParetoFront.tsx index 83794efc..d3255a1e 100644 --- a/optuna_dashboard/ts/components/GraphParetoFront.tsx +++ b/optuna_dashboard/ts/components/GraphParetoFront.tsx @@ -161,7 +161,10 @@ const GraphParetoFrontFrontend: FC<{ ) } -const filterFunc = (trial: Trial, directions: Optuna.StudyDirection[]): boolean => { +const filterFunc = ( + trial: Trial, + directions: Optuna.StudyDirection[] +): boolean => { return ( trial.state === "Complete" && trial.values !== undefined && diff --git a/optuna_dashboard/ts/components/GraphSlice.tsx b/optuna_dashboard/ts/components/GraphSlice.tsx index 1535d246..2137296e 100644 --- a/optuna_dashboard/ts/components/GraphSlice.tsx +++ b/optuna_dashboard/ts/components/GraphSlice.tsx @@ -291,7 +291,9 @@ const plotSlice = ( automargin: true, // Otherwise the label is outside of the plot } } else { - const vocabArr = selectedParamSpace.distribution.choices.map((c) => c?.toString() ?? "null") + const vocabArr = selectedParamSpace.distribution.choices.map( + (c) => c?.toString() ?? "null" + ) const tickvals: number[] = vocabArr.map((v, i) => i) layout["xaxis"] = { title: selectedParamTarget.toLabel(), diff --git a/optuna_dashboard/ts/components/StudyHistory.tsx b/optuna_dashboard/ts/components/StudyHistory.tsx index 44d3378e..ea979db2 100644 --- a/optuna_dashboard/ts/components/StudyHistory.tsx +++ b/optuna_dashboard/ts/components/StudyHistory.tsx @@ -52,7 +52,10 @@ export const StudyHistory: FC<{ studyId: number }> = ({ studyId }) => { ] const trials: Trial[] = studyDetail?.trials || [] return ( - + {widgetStates.map((ws) => ws.render())} ( + = ({ queried.length > 0 ? queried : trials.length > 0 ? [trials[0]] : [] return ( - - + = ({ = ({ - + {selected.length === 0 ? null : selected.map((t) => ( diff --git a/optuna_dashboard/ts/dominatedTrials.ts b/optuna_dashboard/ts/dominatedTrials.ts index 6110f545..d8188cf4 100644 --- a/optuna_dashboard/ts/dominatedTrials.ts +++ b/optuna_dashboard/ts/dominatedTrials.ts @@ -1,6 +1,9 @@ import * as Optuna from "@optuna/types" -const filterFunc = (trial: Trial, directions: Optuna.StudyDirection[]): boolean => { +const filterFunc = ( + trial: Trial, + directions: Optuna.StudyDirection[] +): boolean => { return ( trial.state === "Complete" && trial.values !== undefined && diff --git a/optuna_dashboard/ts/trialFilter.ts b/optuna_dashboard/ts/trialFilter.ts index e9e1860a..13aa3eec 100644 --- a/optuna_dashboard/ts/trialFilter.ts +++ b/optuna_dashboard/ts/trialFilter.ts @@ -211,7 +211,10 @@ export const useObjectiveAndUserAttrTargetsFromStudies = ( }, [studies]) const intersect = (arrays: Optuna.AttributeSpec[][]) => { - const atrEqual = (obj1: Optuna.AttributeSpec, obj2: Optuna.AttributeSpec) => { + const atrEqual = ( + obj1: Optuna.AttributeSpec, + obj2: Optuna.AttributeSpec + ) => { return obj1.key === obj2.key } return arrays.reduce((a, b) =>