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. Ubuntu中chrome浏览器安装、卸载

    一.卸载 sudo apt-get autoremove google-chrome-stable 删除下载源:sudo rm /etc/apt/sources.list.d/google-chrom ...

  2. 关于XXE

    NJUPT CTF2019: 做题的时候,抓包看了一下,响应XML格式消息,并没有严格过滤,这道题读文件, <!DOCTYPE foo [ <!ENTITY xxe SYSTEM &quo ...

  3. cookie和会话

    一.为什么要使用cookie和会话 HTTP是一种无状态技术,这意味着每个单独的HTNML页面都是一个无关的.当人们穿过站点时,HTTP 没有用于跟踪用户或保持变量的方法,尽管浏览器会跟踪你访问过的页 ...

  4. 虚拟机中CentOS 6.5 添加扩展分区

    此扩展方法要求支持LVM 1.更改虚拟机配置 虚拟机->设置->硬盘->扩展磁盘容量 fdisk -l 查看,发现硬盘空间变大了 [root@thj Desktop]# fdisk ...

  5. 洛谷P1051 谁拿了最多奖学金

    https://www.luogu.org/problem/P1051 #include<bits/stdc++.h> using namespace std; struct node { ...

  6. 《深入理解Java虚拟机》读书笔记六

    第七章 虚拟机类加载机制 1.类加载的时机 虚拟机的类加载机制: 虚拟机把描述类的数据从class文件中加载到内存,并对数据进行校验.转换解析和初始化,最终形成了可以被虚拟机直接使用的Java类型,这 ...

  7. linux交互执行命令,expect

    转载 http://donex.blog.51cto.com/2005970/834467 原文比较乱,只能参考 本地交互执行: 1. 修改shell#!/usr/bin/expectset USER ...

  8. SQLserver各种时间取值格式

    叫大哥 SQLServer提取日期中的年月日及其他格式 SQLServer提取日期中的年月日及其他格式   提取年:datepart(yy,getdate())提取月:datepart(mm,getd ...

  9. Android 开发OOM解决方案

    OOM(Out Of Memory)在加载图片过多或者过大的情况下会发生OOM,可以查看APP最高可用内存: int maxMemory = (int) (Runtim.getRuntime().ma ...

  10. IIS的部署

    https://blog.csdn.net/miner_k/article/details/69388726 https://blog.csdn.net/miner_k/article/details ...