Skip to content

Commit 3c4251f

Browse files
committed
[ML] Sort order of binary class form smallest bottom to biggest top
1 parent da48b1a commit 3c4251f

File tree

1 file changed

+9
-7
lines changed
  • x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/total_feature_importance_summary

1 file changed

+9
-7
lines changed

x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/total_feature_importance_summary/feature_importance_summary.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,15 @@ export const FeatureImportanceSummaryPanel: FC<FeatureImportanceSummaryPanelProp
120120
// if binary classification
121121
if (totalFeatureImportance[0].classes.length === 2) {
122122
classificationType = 'binary_classification';
123-
sortedData = (totalFeatureImportance as ClassificationTotalFeatureImportance[]).map((d) => {
124-
return {
125-
featureName: d.feature_name,
126-
// in case of binary classification, both classes will have the same mean importance
127-
meanImportance: d.classes[0].importance.mean_magnitude,
128-
};
129-
});
123+
sortedData = (totalFeatureImportance as ClassificationTotalFeatureImportance[])
124+
.map((d) => {
125+
return {
126+
featureName: d.feature_name,
127+
// in case of binary classification, both classes will have the same mean importance
128+
meanImportance: d.classes[0].importance.mean_magnitude,
129+
};
130+
})
131+
.sort((a, b) => b.meanImportance - a.meanImportance);
130132
}
131133

132134
// if multiclass classification

0 commit comments

Comments
 (0)