mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-12 12:40:33 +08:00
Replace null -> undefined in trial.values to support type
This commit is contained in:
@@ -289,7 +289,7 @@ class JournalStorage {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
thisTrial.state = trialStateNumToTrialState(log.state)
|
thisTrial.state = trialStateNumToTrialState(log.state)
|
||||||
thisTrial.values = log.values
|
thisTrial.values = log.values === null ? undefined : log.values
|
||||||
thisTrial.datetime_start = log.datetime_start
|
thisTrial.datetime_start = log.datetime_start
|
||||||
? new Date(log.datetime_start)
|
? new Date(log.datetime_start)
|
||||||
: undefined
|
: undefined
|
||||||
@@ -350,17 +350,17 @@ const loadJournalStorage = (arrayBuffer: ArrayBuffer): Optuna.Study[] => {
|
|||||||
escapedLog = escapedLog.replace(/-Infinity/g, '"***-inf***"')
|
escapedLog = escapedLog.replace(/-Infinity/g, '"***-inf***"')
|
||||||
escapedLog = escapedLog.replace(/Infinity/g, '"***inf***"')
|
escapedLog = escapedLog.replace(/Infinity/g, '"***inf***"')
|
||||||
return JSON.parse(escapedLog, (_key, value) => {
|
return JSON.parse(escapedLog, (_key, value) => {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case "***nan***":
|
case "***nan***":
|
||||||
return NaN
|
return NaN
|
||||||
case "***-inf***":
|
case "***-inf***":
|
||||||
return -Infinity
|
return -Infinity
|
||||||
case "***inf***":
|
case "***inf***":
|
||||||
return Infinity
|
return Infinity
|
||||||
default:
|
default:
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
|||||||
Reference in New Issue
Block a user