from sklearn.feature_selection import SelectPercentile,f_classif

#数据预处理过滤式特征选取SelectPercentile模型
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=SelectPercentile(score_func=f_classif,percentile=10)
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()

吴裕雄 python 机器学习——数据预处理过滤式特征选取SelectPercentile模型的更多相关文章

  1. 吴裕雄 python 机器学习——数据预处理过滤式特征选取VarianceThreshold模型

    from sklearn.feature_selection import VarianceThreshold #数据预处理过滤式特征选取VarianceThreshold模型 def test_Va ...

  2. 吴裕雄 python 机器学习——数据预处理包裹式特征选取模型

    from sklearn.svm import LinearSVC from sklearn.datasets import load_iris from sklearn.feature_select ...

  3. 吴裕雄 python 机器学习——数据预处理正则化Normalizer模型

    from sklearn.preprocessing import Normalizer #数据预处理正则化Normalizer模型 def test_Normalizer(): X=[[1,2,3, ...

  4. 吴裕雄 python 机器学习——数据预处理标准化MaxAbsScaler模型

    from sklearn.preprocessing import MaxAbsScaler #数据预处理标准化MaxAbsScaler模型 def test_MaxAbsScaler(): X=[[ ...

  5. 吴裕雄 python 机器学习——数据预处理标准化StandardScaler模型

    from sklearn.preprocessing import StandardScaler #数据预处理标准化StandardScaler模型 def test_StandardScaler() ...

  6. 吴裕雄 python 机器学习——数据预处理标准化MinMaxScaler模型

    from sklearn.preprocessing import MinMaxScaler #数据预处理标准化MinMaxScaler模型 def test_MinMaxScaler(): X=[[ ...

  7. 吴裕雄 python 机器学习——数据预处理二元化OneHotEncoder模型

    from sklearn.preprocessing import OneHotEncoder #数据预处理二元化OneHotEncoder模型 def test_OneHotEncoder(): X ...

  8. 吴裕雄 python 机器学习——数据预处理二元化Binarizer模型

    from sklearn.preprocessing import Binarizer #数据预处理二元化Binarizer模型 def test_Binarizer(): X=[[1,2,3,4,5 ...

  9. 吴裕雄 python 机器学习——数据预处理字典学习模型

    from sklearn.decomposition import DictionaryLearning #数据预处理字典学习DictionaryLearning模型 def test_Diction ...

随机推荐

  1. vjudge A Funny Game 思维题 (其实今天讲的全是数学。。。)

    原文链接https://vjudge.net/contest/331993#problem/H Alice and Bob decide to play a funny game. At the be ...

  2. A - Wireless Network POJ - 2236-kuangbin带你飞

    A - Wireless Network POJ - 2236 Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 50348 ...

  3. 微信小程序weui的使用

    大家好,我是前端菜鸟,大家可以叫我惊蛰,今天给大家分享一下在微信小程序中对weui的引入和使用,其他的也不再赘述,文中有不对的还请指正,谢谢. 直入主题: 1.下载weui 进入GitHub http ...

  4. Aspx Ajax 调用 C#函数处理数据

    jquery ajax 调用后台函数 var res; $.ajax({ type: "POST", url: "fast_index_overview.aspx/Get ...

  5. 关于 RMAN 控制文件自动备份路径中指定的 %F 说明

    默认情况下,RMAN备份的属性配置一共 14 行( show all; )来自博客园AskScuti CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVIC ...

  6. python3练习100题——032

    链接:http://www.runoob.com/python/python-exercise-example32.html 题目:按相反的顺序输出列表的值. 我的代码: for i in li[:: ...

  7. bat文件一键运行python自动化脚本

    目标:建立一个双击即可运行自动化脚本的机制,而不用每次运行编译器,方便测试人员用户体验. 方法: 1. 将所有代码打包成exe文件,但一旦修改,又要重新打包. 2. 将运行代码写成bat文件,双击即执 ...

  8. python dataframe筛选列表的值转为list【常用】

    网上方法参差不齐,无注释解释不好秒懂,没有自己想要的,故自己试验一番~ 1. 筛选列表中,当b列中为’1’时,所有c的值,然后转为list 2 .筛选列表中,当a列中为'one',b列为'1'时,所有 ...

  9. javaScript(Date与Math的API)

    目录 Math Math的两个属性值 E PI abs(); ceil(); floor(); round(); max(); min (); pow(); random sin(); cos(); ...

  10. api接口出现Provisional headers are shown,

    问题分析:根据反馈可以知道,发起请求,但服务器未及时响应,原因可能是超时,或者被拦截