Skip to content

Commit

Permalink
[ML] Fix classification feature importance object.
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Oct 29, 2020
1 parent edc8e2f commit 96ccaef
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -184,13 +184,17 @@ export const getFeatureImportance = (

// return object structure for classification job
if (classNames !== undefined && classImportance !== undefined) {
const overallClassNames = classNames?.slice(0, classNames.length / featureNames.length);

return featureNames.map((fName, index) => {
const offset = featureNames.length * index;
const featureClassNames = classNames.slice(offset, offset + featureNames.length);
const featureClassImportance = classImportance.slice(offset, offset + featureNames.length);
const offset = overallClassNames.length * index;
const featureClassImportance = classImportance.slice(
offset,
offset + overallClassNames.length
);
return {
feature_name: fName,
classes: featureClassNames.map((fClassName, fIndex) => {
classes: overallClassNames.map((fClassName, fIndex) => {
return { class_name: fClassName, importance: featureClassImportance[fIndex] };
}),
};
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ interface Props {
}

export const ExplorationResultsTable: FC<Props> = React.memo(
({ indexPattern, jobConfig, jobStatus, needsDestIndexPattern, searchQuery }) => {
({ indexPattern, jobConfig, needsDestIndexPattern, searchQuery }) => {
const {
services: {
mlServices: { mlApiServices },

0 comments on commit 96ccaef

Please sign in to comment.