Recursive Feature Elimination
Introduction to Recursive Feature Elimination
Welcome! Today's topic is an essential technique in data science and machine learning, called Recursive Feature Elimination (RFE). It's a method used for feature selection—choosing the most relevant input variables in our training data.
In Recursive Feature Elimination, we initially fit the model using all available features. Then, we recursively eliminate the least important features and fit the model again. We continue this process until we are left with the specified number of features. The result is a model that’s potentially more efficient and can generalize better.
Understanding the Recursive Feature Elimination
The concept of Recursive Feature Elimination is simple yet powerful. It is based on the idea of recursively removing the least important features from the model. The process involves the following steps:
- Fit the model using all available features.
- Rank the features based on their importance (coefficients, impurity-based importance, etc.).
- Remove the least important feature(s).
- Repeat steps 1–3 until the desired number of features is reached.
Data Generation With R
Applying Recursive Feature Elimination (with `rpart` via `caret`)
To avoid hook mismatches, we’ll build a self-consistent function set for RFE using caret::caretFuncs and a train(method = "rpart") model. We’ll then rank with varImp.train.
