This question probably has a simple answer to it, so I will get to the point...
How do I retrieve the names of the columns from applying a wrapper method in feature selection?
Code I have used:
from mlxtend.feature_selection import SequentialFeatureSelector as SFS
X = df[['A','B','C','D']].values
y = df[['F']].values
classifier = KNeighborsClassifier(n_neighbors=7)
code = SFS(classifier,
k_features=5,
forward=True,
floating=False,
verbose=8,
scoring='accuracy'
)
code.fit(X, y)
code.k_feature_names_
Output:
Features: 3/3 -- score: 0.78
('1' '2', '3')
Therefore, how do I retrieve the names of the features ('1' '2', '3')
?