from sklearn.datasets import load_iris
from sklearn.feature_selection import SelectPercentile,chi2
iris = load_iris()
X, y = iris.data, iris.target
sp=SelectPercentile(chi2, percentile=34).fit(X,y)
print(sp.scores_)
X_new = sp.fit_transform(X,y)
X_new[:10]
'''sklearn.feature_selection.SelectPercentile(score_func=<function f_classif>, percentile=10):
scores按升序排序,选择排前百分percentile所对应的特征'''
SelectPercentile
最新推荐文章于 2023-12-20 15:12:25 发布