When I use XGBClassifier
with SelectFromModel
the algorithm always returns around five features regardless of the max_features
value
My question is: does XGBClassifier
though that there are only five useful features in my dataset?
from sklearn.feature_selection import SelectFromModel
from xgboost import XGBClassifier
sf=SelectFromModel(XGBClassifier(), max_features=10).fit(X, y)
#The output only contains five True, all remaining are False
print(sf.get_support())
```
sf.get_support()
orsf.get_feature_names_out()
? $\endgroup$[False False False False False False False False False True False True False False False True False False False False True False False ]
This is the output ofsf.get_support()
with fourTrue
. Relating the dataset, all features are numeric when I useSelectKBest
orRFE
it return the exact number (10) $\endgroup$