Merge pull request #225 from yoshinobc/plot-intermediate-values-of-running-trials

plot intermediate values of running trials
This commit is contained in:
Masashi Shibata
2022-05-11 10:59:20 +09:00
committed by GitHub
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ export const actionCreator = () => {
studyId in studyDetails
? studyDetails[studyId].trials.slice(0, nLocalFixedTrials)
: []
study.trials = study.trials.concat(currentFixedTrials)
study.trials = currentFixedTrials.concat(study.trials)
setStudyDetailState(studyId, study)
})
.catch((err) => {
@@ -54,7 +54,8 @@ const plotIntermediateValue = (trials: Trial[], mode: string) => {
const filteredTrials = trials.filter(
(t) =>
t.state === "Complete" ||
(t.state === "Pruned" && t.values && t.values.length > 0)
(t.state === "Pruned" && t.values && t.values.length > 0) ||
t.state == "Running"
)
const plotData: Partial<plotly.PlotData>[] = filteredTrials.map((trial) => {
const values = trial.intermediate_values.filter((iv) => iv.value !== "inf")
@@ -63,7 +64,10 @@ const plotIntermediateValue = (trials: Trial[], mode: string) => {
y: values.map((iv) => iv.value),
mode: "lines+markers",
type: "scatter",
name: `trial #${trial.number}`,
name:
trial.state !== "Running"
? `trial #${trial.number}`
: `trial #${trial.number} (running)`,
}
})
plotly.react(plotDomId, plotData, layout)