📜  如何在 python 代码示例中进行前向特征选择

📅  最后修改于: 2022-03-11 14:47:18.783000             🧑  作者: Mango

代码示例1
#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