I am using scikit-learn to find feature importances using ExtraTreesClassifier and RandomForestClassifier, both of which have feature_importances_ attribute.
The data has 4 numeric predictors, 2 binary predictors and 2 multiclass (3 each) predictors which are converted to 6 dummy variables. There are about 12000 rows in dataset. The outcome variable is binary.
Following are the plots of features importances by 2 classifiers:
As can be seen by above figures, the importances are almost reverse of each other.
SM,SL,SB and LM
are most important by ET and almost least important by RF. Inverse is true for HT,WST,WT and A
.
What could be the reason for such discrepancy? What does it tell about the data and the outcome variable? What is the best way to get feature importances reliably? Thanks for your insight.
Edit: I kept n_estimators=250
. Results are similar with n_estimators=100
n_estimators=250
. Results are similar withn_estimators=100
. $\endgroup$feature_importance_
attribute: scikit-learn.org/stable/modules/generated/… I am not sure how that is calculated. $\endgroup$