mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Merge pull request #724 from nabenabe0928/bug-fix/fix-sort-in-rank-plot-for-inf-values
[bug] Fix an error caused by infinity in trial.values
This commit is contained in:
@@ -152,13 +152,21 @@ const getRankPlotInfo = (
|
||||
const zValues: number[] = []
|
||||
const isFeasible: boolean[] = []
|
||||
const hovertext: string[] = []
|
||||
const convertTrialValueToNumber = (value: TrialValueNumber): number => {
|
||||
// TrialValueNumber takes `number`, "inf", or "-inf".
|
||||
return typeof value === "number"
|
||||
? value
|
||||
: value.includes("-")
|
||||
? -Infinity
|
||||
: Infinity
|
||||
}
|
||||
filteredTrials.forEach((trial, i) => {
|
||||
const xValue = xAxis.values[i]
|
||||
const yValue = yAxis.values[i]
|
||||
if (xValue && yValue && trial.values) {
|
||||
xValues.push(xValue)
|
||||
yValues.push(yValue)
|
||||
const zValue = Number(trial.values[objectiveId])
|
||||
const zValue = convertTrialValueToNumber(trial.values[objectiveId])
|
||||
zValues.push(zValue)
|
||||
const feasibility = trial.constraints.every((c) => c <= 0)
|
||||
isFeasible.push(feasibility)
|
||||
|
||||
Reference in New Issue
Block a user