Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Analytics classification: ensure confusion matrix label column is correct #60308

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ interface ColumnData {
error_count?: number;
}

export const ACTUAL_CLASS_ID = 'actual_class';

export function getColumnData(confusionMatrixData: ConfusionMatrix[]) {
const colData: Partial<ColumnData[]> = [];

Expand Down Expand Up @@ -67,7 +69,7 @@ export function getColumnData(confusionMatrixData: ConfusionMatrix[]) {

const columns: any = [
{
id: 'actual_class',
id: ACTUAL_CLASS_ID,
display: <span />,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
ANALYSIS_CONFIG_TYPE,
} from '../../../../common/analytics';
import { LoadingPanel } from '../loading_panel';
import { getColumnData } from './column_data';
import { getColumnData, ACTUAL_CLASS_ID } from './column_data';

const defaultPanelWidth = 500;

Expand Down Expand Up @@ -205,11 +205,13 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
const cellValue = columnsData[rowIndex][columnId];
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
setCellProps({
style: {
backgroundColor: `rgba(0, 179, 164, ${cellValue})`,
},
});
if (columnId !== ACTUAL_CLASS_ID) {
setCellProps({
style: {
backgroundColor: `rgba(0, 179, 164, ${cellValue})`,
},
});
}
}, [rowIndex, columnId, setCellProps]);
return (
<span>{typeof cellValue === 'number' ? `${Math.round(cellValue * 100)}%` : cellValue}</span>
Expand Down