I am trying to work on feature selection stage for my dataset.
I am a newbie to ML. I have around 60 columns and am trying to select top 15 features. I came to know about RFECV for which I wrote a code like as shown below. I am aware that
n_features is present for
RFE but it is missing for
RFECV. Is there anyother way to assign the
number of features to select?
model = RandomForestClassifier(n_estimators=100, random_state=0) # create the RFE model and select 15 attributes rfe = RFECV(model,step=5, cv=5,min_features_to_select = 15,max_features_to_select = 15) # this doesn't work. `n_features=15` also doesn't work rfe = rfe.fit(X_train_std, y_train) # summarize the selection of the attributes feat = rfe.support_ fret = rfe.ranking_ features = X.columns print(features[feat].tolist())
Can someone help me to get top 15 features only? Where can I configure the
Currently it displays more than 30 features. I don't really know how or from where does it get its number (30)?