scikit-learn-contrib / boruta_py

Python implementations of the Boruta all-relevant feature selection method.
BSD 3-Clause "New" or "Revised" License
1.46k stars 252 forks source link

Ranking the features #58

Closed xypan1232 closed 5 years ago

xypan1232 commented 5 years ago

Hi, I want to get the ranking of features according to their scores, I know random forest can score each feature with different scores. featselector.ranking can output some ranked features, but many features have the same level , e.g. [ 1 1 1 1 1 1 1 28 7 12 16 17 2 31 32 25 30 4 3 24 28 133 386 415 426 117 493 407 185 453 202 310 199 73 74 302], could I ask how can I further rank the features for those features with the same level. thanks.

haleemason commented 5 years ago

Since Boruta is an all relevant feature selection method, this will occur quite often. Having many features ranked as the same level is showing that all of those features are relevant to the problem you are trying to solve and should be considered for subsequent feature selection techniques or modeling approaches. It doesn't rank them from first to last, but rather it tries to capture all the important, interesting features you might have in your dataset with respect to an outcome variable.

"Boruta is an all relevant feature selection method, while most other are minimal optimal; this means it tries to find all features carrying information usable for prediction, rather than finding a possibly compact subset of features on which some classifier has a minimal error." - Miron B. Kursa

Even so, the R package of this algorithm offers a graphical summary of the importances which could be helpful for ranking them (found page 3). This is something I am working on a pull request for the Python implementation. This function would use boxplots to show the distribution of features’ importance over the Boruta run, using colours to mark final decision; it also draws boxplots for the importance of worst, average and best shadow in each iterations.

Finally, you could consider other methods (Recursive Feature Elimination or Feature Importances) if you are looking for a ranking algorithm or to find the smallest subset of possible features such as these:

danielhomola commented 5 years ago

thanks a lot @haleemason for clearing this up! closing this now.