diff --git a/src/webui/src/components/trial-detail/TableList.tsx b/src/webui/src/components/trial-detail/TableList.tsx index 4b4856c50e..e048d24cbe 100644 --- a/src/webui/src/components/trial-detail/TableList.tsx +++ b/src/webui/src/components/trial-detail/TableList.tsx @@ -586,17 +586,16 @@ const AccuracyColumnConfig: ColumnProps = { dataIndex: 'accuracy', width: 120, sorter: (a, b, sortOrder) => { - if (a.accuracy === undefined) { - return sortOrder === 'ascend' ? -1 : 1; - } else if (b.accuracy === undefined) { + if (a.latestAccuracy === undefined) { return sortOrder === 'ascend' ? 1 : -1; + } else if (b.latestAccuracy === undefined) { + return sortOrder === 'ascend' ? -1 : 1; } else { - return a.accuracy - b.accuracy; + return a.latestAccuracy - b.latestAccuracy; } }, render: (text, record) => ( - // TODO: is this needed? -
{record.latestAccuracy}
+
{record.formattedLatestAccuracy}
) }; diff --git a/src/webui/src/static/function.ts b/src/webui/src/static/function.ts index be352ff35c..2c7b7283e5 100644 --- a/src/webui/src/static/function.ts +++ b/src/webui/src/static/function.ts @@ -186,5 +186,5 @@ function formatAccuracy(accuracy: number): string { export { convertTime, convertDuration, getFinalResult, getFinal, downFile, intermediateGraphOption, killJob, filterByStatus, filterDuration, - formatAccuracy, formatTimestamp, metricAccuracy, + formatAccuracy, formatTimestamp, metricAccuracy }; diff --git a/src/webui/src/static/interface.ts b/src/webui/src/static/interface.ts index 44789ab7f0..dcde43da6f 100644 --- a/src/webui/src/static/interface.ts +++ b/src/webui/src/static/interface.ts @@ -24,7 +24,8 @@ interface TableRecord { status: string; intermediateCount: number; accuracy?: number; - latestAccuracy: string; // formatted string + latestAccuracy: number | undefined; + formattedLatestAccuracy: string; // format (LATEST/FINAL) } interface SearchSpace { diff --git a/src/webui/src/static/model/trial.ts b/src/webui/src/static/model/trial.ts index 58be735404..e0a399c46d 100644 --- a/src/webui/src/static/model/trial.ts +++ b/src/webui/src/static/model/trial.ts @@ -46,6 +46,22 @@ class Trial implements TableObj { return this.metricsInitialized && this.finalAcc !== undefined && !isNaN(this.finalAcc); } + get latestAccuracy(): number | undefined { + if (this.accuracy !== undefined) { + return this.accuracy; + } else if (this.intermediates.length > 0) { + // TODO: support intermeidate result is dict + const temp = this.intermediates[this.intermediates.length - 1]; + if (temp !== undefined) { + return JSON.parse(temp.data); + } else { + return undefined; + } + } else { + return undefined; + } + } + /* table obj start */ get tableRecord(): TableRecord { @@ -62,7 +78,8 @@ class Trial implements TableObj { status: this.info.status, intermediateCount: this.intermediates.length, accuracy: this.finalAcc, - latestAccuracy: this.formatLatestAccuracy(), + latestAccuracy: this.latestAccuracy, + formattedLatestAccuracy: this.formatLatestAccuracy(), }; }