From the version 0.24, the scikit-learn has new method 'SequentialFeatureSelector', which adds (forward selection) or removes (backward selection) features to form a feature subset in a greedy fashion. It lets us to select features in the 'forward stepwise selection' or 'backward stepwise selection', described in the book 'Introduction to Statistical Learning (ISLR)'.
To use the SequentialFeatureSelector, you need to put 'int' or 'float' value to the parameter
n_features_to_select
. If you don't write anything, half of feature numbers are automatically put into the parameter. However, according to ISLR, you can know how many number of variables are appropriate only after you test all number of parameters and get the best model of each number of parameters. The plots shown below is from the ISLR, which shows that you can figure out how many number of features are appropriate only after testing all numbers of predictors. You cannot figure it out beforehand.
So I think an input "the lowest adjusted r_squared" for the parameter
n_features_to_select
. By doing so, you can choose the number of features that has the lowest adjusted r_squared, which cannot be known beforehand.Why is scikit-learn made in such a way that int or float must be put into the parameter?