From 57da7779d5c32744c14b85d73048dc8a73da82b8 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Tue, 25 Mar 2025 16:09:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9C=BA=E5=99=A8=E5=AD=A6=E4=B9=A0=E6=8C=87=E6=A0=87=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/pages/AutoML/Instance/index.tsx | 2 +- .../components/ExperimentHistory/index.tsx | 24 +++++++++++-------- .../components/ExperimentList/index.tsx | 1 + react-ui/src/pages/Experiment/index.jsx | 1 + 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/react-ui/src/pages/AutoML/Instance/index.tsx b/react-ui/src/pages/AutoML/Instance/index.tsx index 60cc2142..933b496e 100644 --- a/react-ui/src/pages/AutoML/Instance/index.tsx +++ b/react-ui/src/pages/AutoML/Instance/index.tsx @@ -28,7 +28,6 @@ function AutoMLInstance() { const [autoMLInfo, setAutoMLInfo] = useState(undefined); const [instanceInfo, setInstanceInfo] = useState(undefined); const params = useParams(); - // const autoMLId = safeInvoke(Number)(params.autoMLId); const instanceId = safeInvoke(Number)(params.id); const evtSourceRef = useRef(null); @@ -187,6 +186,7 @@ function AutoMLInstance() { icon: , children: ( diff --git a/react-ui/src/pages/AutoML/components/ExperimentHistory/index.tsx b/react-ui/src/pages/AutoML/components/ExperimentHistory/index.tsx index 09d0cd6e..0441a623 100644 --- a/react-ui/src/pages/AutoML/components/ExperimentHistory/index.tsx +++ b/react-ui/src/pages/AutoML/components/ExperimentHistory/index.tsx @@ -8,8 +8,9 @@ import TrialStatusCell from '../TrialStatusCell'; import styles from './index.less'; type ExperimentHistoryProps = { - fileUrl?: string; - isClassification: boolean; + calcMetrics?: string; // 计算指标 + fileUrl?: string; // 文件url + isClassification: boolean; // 是否是分类 }; type TableData = { @@ -22,7 +23,7 @@ type TableData = { althorithm?: string; }; -function ExperimentHistory({ fileUrl, isClassification }: ExperimentHistoryProps) { +function ExperimentHistory({ calcMetrics, fileUrl, isClassification }: ExperimentHistoryProps) { const [tableData, setTableData] = useState([]); useEffect(() => { // 获取实验运行历史记录 @@ -33,7 +34,7 @@ function ExperimentHistory({ fileUrl, isClassification }: ExperimentHistoryProps const list: TableData[] = data.map((item) => { return { id: item[0]?.[0], - accuracy: item[1]?.[5]?.accuracy, + accuracy: calcMetrics ? item[1]?.[5]?.[calcMetrics] : undefined, duration: item[1]?.[5]?.duration, train_loss: item[1]?.[5]?.train_loss, status: item[1]?.[2]?.['__enum__']?.split('.')?.[1], @@ -64,12 +65,6 @@ function ExperimentHistory({ fileUrl, isClassification }: ExperimentHistoryProps width: 80, render: tableCellRender(false), }, - { - title: '准确率', - dataIndex: 'accuracy', - key: 'accuracy', - render: tableCellRender(true), - }, { title: '耗时', dataIndex: 'duration', @@ -103,6 +98,15 @@ function ExperimentHistory({ fileUrl, isClassification }: ExperimentHistoryProps }, ]; + if (calcMetrics) { + columns.splice(0, 0, { + title: `指标:${calcMetrics}`, + dataIndex: 'accuracy', + key: 'accuracy', + render: tableCellRender(true), + }); + } + return (
diff --git a/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx b/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx index b4e7f24b..e2f9d31c 100644 --- a/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx +++ b/react-ui/src/pages/AutoML/components/ExperimentList/index.tsx @@ -188,6 +188,7 @@ function ExperimentList({ type }: ExperimentListProps) { if (expanded) { setExpandedRowKeys([record.id]); getExperimentInsList(record.id, 0); + refreshExperimentList(); } else { setExpandedRowKeys([]); } diff --git a/react-ui/src/pages/Experiment/index.jsx b/react-ui/src/pages/Experiment/index.jsx index 9b7cab84..b3a288b1 100644 --- a/react-ui/src/pages/Experiment/index.jsx +++ b/react-ui/src/pages/Experiment/index.jsx @@ -206,6 +206,7 @@ function Experiment() { setExpandedRowKeys(null); } else { getQueryByExperiment(record.id, 0); + refreshExperimentList(); } };