热线电话:13121318867

登录
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 值 (或者仅仅是SelectKBestSelectPercentile的分数):

0.0000
1
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子