如何获得特征选择方法的准确性?

数据挖掘 特征选择 准确性
2022-02-13 02:15:36

我使用了以下方法:

方差_阈值:selecto_vth = VarianceThreshold(threshold=1.0)

方差分析:anova = SelectKBest(score_func=f_classif, k=20)

相互信息:fs_mutual = SelectKBest(score_func=mutual_info_classif, k=20)

Sequential_Feature_Selector:sfs = SequentialFeatureSelector(RandomForestClassifier(), n_features_to_select=20, scoring='accuracy')

但我没有找到如何获得他们的准确性,不像递归特征消除:

print(accuracy_score(y_test, rfe.predict(x_test))) # it worked
1个回答

一种方法(顺便说一句,我不知道其他方法)是创建一个具有(最佳)选定特征的模型并测量该模型的准确性。

此准确性将由您使用的模型参数化。例如,使用不同的模型可能会改变准确性,因此使用少数模型并获得平均值将为您提供所选特征的准确性的提示。

此过程与sklearn.feature_selection.RFE之后的过程完全相同,其中模型(估计器)作为参数传递。