Optimizing the number of features with ML models
Another way to optimize our models is to use feature selection with the models. To do this, we need models that have a coefficient or feature importance aspect, such as linear regression, logistic regression, or tree-based methods. We can use forward, backward, or recursive feature selection. Both recursive and backward selection start with all features, then remove features that are least important.
However, forward or backward selection (sequential selection) fits several models to select each feature to add or remove, while recursive selection only fits one model for each feature it removes. For example, the first feature from forward selection would be found by fitting a model with each feature separately and taking the model with the best performance. For recursive selection, we fit one model and remove the feature that is least important (indicated by feature importance or feature coefficients). After the process, we can...