Sklearn 卡方检验
见知乎
小白记录贴,侵删~感恩!
使用sklearn官方接口代码如下
首先import包和实验数据:
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import chi2
from sklearn.datasets import load_iris
iris = load_iris()
2. 使用卡方检验来选择特征
model1 = SelectKBest(chi2, k=2
原创
2021-03-17 15:43:07 ·
1683 阅读 ·
0 评论