Browse Source

feat: 修改自动机器学习指标参数

pull/189/head
cp3hnu 10 months ago
parent
commit
57da7779d5
4 changed files with 17 additions and 11 deletions
  1. +1
    -1
      react-ui/src/pages/AutoML/Instance/index.tsx
  2. +14
    -10
      react-ui/src/pages/AutoML/components/ExperimentHistory/index.tsx
  3. +1
    -0
      react-ui/src/pages/AutoML/components/ExperimentList/index.tsx
  4. +1
    -0
      react-ui/src/pages/Experiment/index.jsx

+ 1
- 1
react-ui/src/pages/AutoML/Instance/index.tsx View File

@@ -28,7 +28,6 @@ function AutoMLInstance() {
const [autoMLInfo, setAutoMLInfo] = useState<AutoMLData | undefined>(undefined);
const [instanceInfo, setInstanceInfo] = useState<AutoMLInstanceData | undefined>(undefined);
const params = useParams();
// const autoMLId = safeInvoke(Number)(params.autoMLId);
const instanceId = safeInvoke(Number)(params.id);
const evtSourceRef = useRef<EventSource | null>(null);

@@ -187,6 +186,7 @@ function AutoMLInstance() {
icon: <KFIcon type="icon-Trialliebiao" />,
children: (
<ExperimentHistory
calcMetrics={autoMLInfo?.scoring_functions}
fileUrl={instanceInfo?.run_history_path}
isClassification={autoMLInfo?.task_type === AutoMLTaskType.Classification}
/>


+ 14
- 10
react-ui/src/pages/AutoML/components/ExperimentHistory/index.tsx View File

@@ -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<TableData[]>([]);
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 (
<div className={styles['experiment-history']}>
<div className={styles['experiment-history__content']}>


+ 1
- 0
react-ui/src/pages/AutoML/components/ExperimentList/index.tsx View File

@@ -188,6 +188,7 @@ function ExperimentList({ type }: ExperimentListProps) {
if (expanded) {
setExpandedRowKeys([record.id]);
getExperimentInsList(record.id, 0);
refreshExperimentList();
} else {
setExpandedRowKeys([]);
}


+ 1
- 0
react-ui/src/pages/Experiment/index.jsx View File

@@ -206,6 +206,7 @@ function Experiment() {
setExpandedRowKeys(null);
} else {
getQueryByExperiment(record.id, 0);
refreshExperimentList();
}
};



Loading…
Cancel
Save