-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] DF Analytics: create classification jobs results view #52584
[ML] DF Analytics: create classification jobs results view #52584
Conversation
Pinging @elastic/ml-ui (:ml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great update! I added some suggestions/questions mainly about types.
@walterra - thanks for taking a look! All type updates added here: f5bb0a7ce4b99256d4cc250ab2c3be42d997a7c1
x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.ts
Outdated
Show resolved
Hide resolved
x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.ts
Outdated
Show resolved
Hide resolved
}); | ||
}); | ||
|
||
const columns: any = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could possibly be EuiDataGridColumn[]
from https://github.com/elastic/eui/blob/master/src/components/datagrid/data_grid_types.ts
...alytics/pages/analytics_exploration/components/classification_exploration/evaluate_panel.tsx
Outdated
Show resolved
Hide resolved
const [confusionMatrixData, setConfusionMatrixData] = useState< | ||
ClassificationEvaluateResponse['classification']['multiclass_confusion_matrix']['confusion_matrix'] | ||
>([]); | ||
const [columns, setColumns] = useState<any>([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use EuiDataGridColumn[]
from https://github.com/elastic/eui/blob/master/src/components/datagrid/data_grid_types.ts
}, | ||
}); | ||
} | ||
}, [confusionMatrixData]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To do a deep equal, maybe JSON.stringify(confusionMatrixData)
is worth doing here similar to JSON.stringify(searchQuery)
further down.
...nalytics/pages/analytics_exploration/components/classification_exploration/results_table.tsx
Outdated
Show resolved
Hide resolved
Feedback on look and feel of the confusion matrix (but I don't think this should prevent the merge as it can be a follow up). Using the full width for the confusion matrix table makes it hard to read for wide screens. It is useful to be able to compare adjacent row and column values. When stretched across the page, this becomes more difficult. |
When resizing one of the confusion matrix columns, the data grid expands beyond the page width, this also then affects the results table below: Might be related to this data grid issue: elastic/eui#2618 When resizing the page, the confusion matrix data grid also doesn't update it's width. @walterra - looks like it is related to the data grid issue you linked above. I've added a fix for the column resize affecting the results table. I've set the evalute panel width to the results table width - this prevents the data grid resizing from affecting the results table and ensures the evalute panel has a fixed width (f0a909dbe1185f734890d10559e1ea0390e4a49a) The data grid ignoring the parent width issue is still seen but I'll do a bit more digging on that. |
When clicking on the popover button of a cell in the confusion matrix, I'm getting this in the console: Not sure if we're using Heya @walterra - looks like this was being caused due to the |
With some searches I end up with an empty page and errors like this: It doesn't happen with every type of search. For example, note that the search worked with e.g. @walterra - nice catch! This was occurring because there was an assumption that there would always be a correct class and incorrect class predicted. In some cases there is only the correctly predicted class in the confusion matrix. I've updated to check for that here 81e4b50be749c46700fc1ec944da83f1cda29679 |
..._analytics/pages/analytics_exploration/components/classification_exploration/column_data.tsx
Show resolved
Hide resolved
...alytics/pages/analytics_exploration/components/classification_exploration/evaluate_panel.tsx
Show resolved
Hide resolved
x-pack/legacy/plugins/ml/public/application/data_frame_analytics/common/analytics.ts
Show resolved
Hide resolved
...alytics/pages/analytics_exploration/components/classification_exploration/evaluate_panel.tsx
Outdated
Show resolved
Hide resolved
retest |
Regarding const CellValue: FC<{
rowIndex: number;
columnId: string;
setCellProps: any;
}> = ({ rowIndex, columnId, setCellProps }) => {
const cellValue = columnsData[rowIndex][columnId];
useEffect(() => {
setCellProps({
style: {
backgroundColor: `rgba(0, 179, 164, ${cellValue})`,
},
});
}, [cellValue, setCellProps]);
return (
<span>{typeof cellValue === 'number' ? `${Math.round(cellValue * 100)}%` : cellValue}</span>
);
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest changes LGTM, just added a suggestion above regarding the linting problem with useEffect()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested latest changes and all LGTM.
I prefer the confusion matrix not going full width. Looks better as the table only has the two columns.
…ove unused translation
c78a293
to
a134796
Compare
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
…2584) * wip: create classification results page + table and evaluate panel * enable view link for classification jobs * wip: fetch classification eval data * wip: display confusion matrix in datagrid * evaluate panel: add heatmap for cells and doc count * Update use of loadEvalData in expanded row component * Add metric type for evaluate endpoint and fix localization error * handle no incorrect prediction classes case for confusion matrix. remove unused translation * setCellProps needs to be called from a lifecycle method - wrap in useEffect * TypeScript improvements * fix datagrid column resize affecting results table * allow custom prediction field for classification jobs * ensure values are rounded correctly and add tooltip * temp workaroun for datagrid width issues
…52941) * wip: create classification results page + table and evaluate panel * enable view link for classification jobs * wip: fetch classification eval data * wip: display confusion matrix in datagrid * evaluate panel: add heatmap for cells and doc count * Update use of loadEvalData in expanded row component * Add metric type for evaluate endpoint and fix localization error * handle no incorrect prediction classes case for confusion matrix. remove unused translation * setCellProps needs to be called from a lifecycle method - wrap in useEffect * TypeScript improvements * fix datagrid column resize affecting results table * allow custom prediction field for classification jobs * ensure values are rounded correctly and add tooltip * temp workaroun for datagrid width issues
Summary
NOTE: This will need to be updated to account for changes to the
_evaluate
endpoint introduced in elastic/ml-cpp#877 in which the.keyword
suffix will no longer be needed for boolean or integer dependent variable fields. Once the ES build contains the change I'll be able to test it.Added this to the meta issue to do in a follow-up: #51310
cc @peteharverson, @walterra
Related meta issue: #51310
View
link in Analytics jobs list for classification jobs_evaluate
endpoint_evaluate
endpoint is rerun with search queries executed in the results tableChecklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.- [ ] Documentation was added for features that require explanation or tutorialsFor maintainers
- [ ] This was checked for breaking API changes and was labeled appropriately- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately