I have several random forest models that work well. Now, I would like to do feature selection based on this models. How do I find out which features were used frequently by a model e.g. RandomForestClassifier in scikit-learn?
3 Answers
Feature importance it is a property of the random forrest classifier.
See an example here
Just to add to the feature Importance of the RF's , don't forget to use the hierarchical clustering from scipy and plot the dendograms..
It will help you find the similar columns..
-
$\begingroup$ You mean in order to not use strongly correlated columns? $\endgroup$– SorenMar 1, 2018 at 12:59
-
$\begingroup$ Plotting the dendogram will reveal the similar columns so you can take a sneak peak at them and them do experiments like dropping one of them let say and then re run the model and recur $\endgroup$– AdityaMar 1, 2018 at 13:11
Try looking at the DALEX package for R. It is designed to specifically investigate the importance of input variables to perhaps otherwise opaque ML algos.