diff --git a/standalone_app/src/components/PlotHistory.tsx b/standalone_app/src/components/PlotHistory.tsx index 24f90034..b94c5ac8 100644 --- a/standalone_app/src/components/PlotHistory.tsx +++ b/standalone_app/src/components/PlotHistory.tsx @@ -178,8 +178,8 @@ const filterFunc = (trial: Trial, objectiveId: number): boolean => { } return ( trial.values.length > objectiveId && - trial.values[objectiveId] !== "inf" && - trial.values[objectiveId] !== "-inf" + trial.values[objectiveId] !== Infinity && + trial.values[objectiveId] !== -Infinity ) } @@ -244,7 +244,7 @@ const plotHistory = ( return null } const value = trial.values[objectiveId] - if (value === "inf" || value === "-inf") { + if (value === Infinity || value === -Infinity) { return null } return value diff --git a/standalone_app/src/components/PlotImportance.tsx b/standalone_app/src/components/PlotImportance.tsx index 8135be26..5b4baf02 100644 --- a/standalone_app/src/components/PlotImportance.tsx +++ b/standalone_app/src/components/PlotImportance.tsx @@ -80,8 +80,8 @@ const filterFunc = (trial: Trial, objectiveId: number): boolean => { } return ( trial.values.length > objectiveId && - trial.values[objectiveId] !== "inf" && - trial.values[objectiveId] !== "-inf" + trial.values[objectiveId] !== Infinity && + trial.values[objectiveId] !== -Infinity ) } diff --git a/standalone_app/src/components/PlotIntermediateValues.tsx b/standalone_app/src/components/PlotIntermediateValues.tsx index 2c10cf74..fbf8cc2a 100644 --- a/standalone_app/src/components/PlotIntermediateValues.tsx +++ b/standalone_app/src/components/PlotIntermediateValues.tsx @@ -80,7 +80,10 @@ const plotIntermediateValue = ( ) const plotData: Partial[] = filteredTrials.map((trial) => { const values = trial.intermediate_values.filter( - (iv) => iv.value !== "inf" && iv.value !== "-inf" && iv.value !== "nan" + (iv) => + iv.value !== Infinity && + iv.value !== -Infinity && + !Number.isNaN(iv.value) ) return { x: values.map((iv) => iv.step), diff --git a/standalone_app/src/components/TrialTable.tsx b/standalone_app/src/components/TrialTable.tsx index d8b4f163..41cabdd4 100644 --- a/standalone_app/src/components/TrialTable.tsx +++ b/standalone_app/src/components/TrialTable.tsx @@ -37,11 +37,6 @@ export const TrialTable: FC<{ } else if (secondVal === undefined) { return ascending ? 1 : -1 } - if (firstVal === "-inf" || secondVal === "inf") { - return 1 - } else if (secondVal === "-inf" || firstVal === "inf") { - return -1 - } return firstVal < secondVal ? 1 : -1 }, toCellValue: (i) => { @@ -69,11 +64,6 @@ export const TrialTable: FC<{ } else if (secondVal === undefined) { return ascending ? 1 : -1 } - if (firstVal === "-inf" || secondVal === "inf") { - return 1 - } else if (secondVal === "-inf" || firstVal === "inf") { - return -1 - } return firstVal < secondVal ? 1 : -1 }, toCellValue: (i) => { diff --git a/standalone_app/src/sqlite3.ts b/standalone_app/src/sqlite3.ts index a0bf018b..0330750b 100644 --- a/standalone_app/src/sqlite3.ts +++ b/standalone_app/src/sqlite3.ts @@ -218,9 +218,9 @@ const getTrialValues = ( callback: (vals: any[]) => { values.push( vals[1] === "INF_NEG" - ? "-inf" + ? -Infinity : vals[1] === "INF_POS" - ? "+inf" + ? Infinity : vals[0] ) }, @@ -389,11 +389,11 @@ const getTrialIntermediateValues = ( step: vals[0], value: vals[2] === "INF_NEG" - ? "-inf" + ? -Infinity : vals[2] === "INF_POS" - ? "+inf" + ? Infinity : vals[2] === "NAN" - ? "nan" + ? NaN : vals[1], }) }, diff --git a/standalone_app/src/types/index.d.ts b/standalone_app/src/types/index.d.ts index da00a7aa..684858e9 100644 --- a/standalone_app/src/types/index.d.ts +++ b/standalone_app/src/types/index.d.ts @@ -1,7 +1,7 @@ declare const IS_VSCODE: boolean -type TrialValueNumber = number | "inf" | "-inf" -type TrialIntermediateValueNumber = number | "inf" | "-inf" | "nan" +type TrialValueNumber = number +type TrialIntermediateValueNumber = number type TrialState = "Running" | "Complete" | "Pruned" | "Fail" | "Waiting" type TrialStateFinished = "Complete" | "Fail" | "Pruned" type StudyDirection = "maximize" | "minimize" | "not_set"