class sklearn.feature_selection.SelectKBest(score_func=<function f_classif>, *, k=10)
score_func是用于特征选择的方法,k是最终选择的特征数
或
class sklearn.feature_selection.SelectPercentile(score_func=<function f_classif>, *, percentile=10)
该函数选择得分前percentile%的特征
score_func有以下几种方法:
用于分类任务的有:
sklearn.feature_selection.
f_classif
sklearn.feature_selection.
mutual_info_classif
sklearn.feature_selection.
chi2
用于回归任务的有:
sklearn.feature_selection.
f_regression
sklearn.feature_selection.
mutual_info_regression