2018-12-08
阅读量:
693
使用 卡方 检验样本集来选择最好的两个特征
>>> from sklearn.datasets import load_iris
>>> from sklearn.feature_selection import SelectKBest
>>> from sklearn.feature_selection import chi2
>>> iris = load_iris()
>>> X, y = iris.data, iris.target
>>> X.shape (150, 4)
>>> X_new = SelectKBest(chi2, k=2).fit_transform(X, y)
>>> X_new.shape (150, 2)
这些对象将得分函数作为输入,返回单变量的得分和 p 值 (或者仅仅是SelectKBest
和SelectPercentile
的分数):






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论