Answers for "how to do forward feature selection in python"

0

how to do forward feature selection in python

#importing the necessary libraries
from mlxtend.feature_selection import SequentialFeatureSelector as SFS
from sklearn.linear_model import LinearRegression
# Sequential Forward Selection(sfs)
sfs = SFS(LinearRegression(),
          k_features=11,
          forward=True,
          floating=False,
          scoring = 'r2',
          cv = 0)

sfs.fit(X, y)
sfs.k_feature_names_     # to get the final set of features
Posted by: Guest on August-05-2021

Code answers related to "how to do forward feature selection in python"

Python Answers by Framework

Browse Popular Code Answers by Language