mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +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,21 +350,21 @@ 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
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
|
||||||
switch (parsedLog.op_code) {
|
switch (parsedLog.op_code) {
|
||||||
case JournalOperation.CREATE_STUDY:
|
case JournalOperation.CREATE_STUDY:
|
||||||
journalStorage.applyCreateStudy(parsedLog as JournalOpCreateStudy)
|
journalStorage.applyCreateStudy(parsedLog as JournalOpCreateStudy)
|
||||||
|
|||||||
Reference in New Issue
Block a user