How to Use RFE for Feature Selection Flashcards
WHAT ARE THE TWO IMPORTANT CONFIGURATION OPTIONS WHEN USING RFE? P192
The choice in the number of features to select (n_features_to_select)
The choice of the algorithm used to help choose features. (estimator)
IS THE PERFORMANCE OF THE RFE STRONGLY DEPENDENT ON n_features_to_select & estimator HYPERPARAMETERS BEING TUNED? P192
No
WHAT DOES “RFE IS A WRAPPER-TYPE FEATURE SELECTION ALGORITHM” MEAN? P193
This means that a different machine learning algorithm is given and used in the core of the method, is wrapped by RFE, and used to help select features
HOW DOES RFE WORK? P193
1-Fitting the given ML algorithm used in the core of the model
2-Ranking features by importance
3-discarding the least important features
4-re-fitting the model and repeating, till the desired number of features remain
HOW CAN WE FIND OUT WHICH FEATURES WERE CHOSEN BY RFE? P194
“support_” attribute. It provides True/False for each feature
HOW CAN WE SYNTHESIZE A CLASSIFICATION PROBLEM? CODE P194
X, y = make_classification (n_samples=1000, n_features=10, n_informative=5, n_redundant=5, random_state=1)
HOW CAN WE AUTOMATICALLY SELECT THE BEST NUMBER OF FEATURES FOR RFE? P200
Using RFECV
USING WHICH PARAMETER OF RFECV, CAN WE CHOOSE THE MINIMUM NUMBER OF CHOSEN FEATURES? WHAT IS ITS DEFAULT VALUE? P200
min_features_to_select, default=1
USING WHICH ATTRIBUTE OF RFE AND RFECV CLASSES CAN WE FIND OUT THE RANKING OF FEATURES? P201
“ranking_” attribute