码迷,mamicode.com
首页 > 其他好文 > 详细

SelectKBest

时间:2019-09-01 16:36:17      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:info   nsf   python   from   技术   sklearn   learn   com   ssi   


https://www.e-learn.cn/content/python/2198918
from sklearn.feature_selection import SelectKBest,f_classif #数据预处理过滤式特征选取SelectKBest模型 def test_SelectKBest(): X=[[1,2,3,4,5], [5,4,3,2,1], [3,3,3,3,3,], [1,1,1,1,1]] y=[0,1,0,1] print("before transform:",X) selector=SelectKBest(score_func=f_classif,k=3) selector.fit(X,y) print("scores_:",selector.scores_) print("pvalues_:",selector.pvalues_) print("selected index:",selector.get_support(True)) print("after transform:",selector.transform(X)) #调用test_SelectKBest() test_SelectKBest()

技术图片

 

SelectKBest

标签:info   nsf   python   from   技术   sklearn   learn   com   ssi   

原文地址:https://www.cnblogs.com/lvdongjie/p/11442575.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!