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

BorutaPy selects different features in different iterations #121

Open VEZcoding opened 9 months ago

VEZcoding commented 9 months ago

First of all thanks for the package, I've been using it a lot in my work.

I came up to something strange. I know Boruta selects everything that is important.

I have a dataframe of 200 observations and 2000 features. if I shuffle the order of the features in the dataframe, Boruta (Random forrest classifier) will return different important features.

Also if I have 200 observations with first 1000 features Boruta selects a list of n-important features. But If I add another 1000 to the mix Boruta will select another set of features and the features from the first 1000 group won't be in them.

So why is Boruta always selecting different features if it should always select the best ones? How can best features change if you change the order of columns.

matteobolner commented 7 months ago

Try setting a random state seed (random_state), and the results should be consistent across runs, even if you change the order of the features. For the second questions, I think it's to be expected that adding data could lead to different results.