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. redis 列表类型list

    列表类型(list)1.插入 左侧插入 :lpush key value1 value2 value3... 右侧插入: lpush key value1 value2 value3... 在指定元素 ...

  2. SpringMVC处理中文乱码

    SpringMVC自带过滤器 添加至web.xml文件 <filter> <filter-name>encoding</filter-name> <filte ...

  3. matlab中的数组与矩阵

    今天做图像处理时,看到一个矩阵的处理,简要谈谈下面几段代码: 首先是介绍矩阵(说明:在matlab中无是数组还是矩阵都是按列来存储的) 首先是一些特殊矩阵的建立 zeros(m,n)%建立全0矩阵 o ...

  4. Nessus安装出现localhost:8834无法访问

    1.下载Nessus https://www.tenable.com/downloads/nessus#download 2.安装方法 详细安装方法参考下文 https://www.ld80.cn/a ...

  5. 呼叫到达率100%,网易云信信令SDK免费上线!

    近期,网易云信推出一款稳定可靠.到达率高.扩展性较强的信令通道产品--信令SDK.它能够提供可靠的消息通道,可用于搭建音视频场景下的呼叫邀请机制.信令SDK目前兼容市面上所有主流的音视频SDK,呼叫到 ...

  6. html中特殊符号对应表

    html中特殊符号的对应表 符号 说明 编码 ‘'  双引号  "  &  and符  &  <  小于号  <  >  大于号  >    空格   ...

  7. 【教程】Visual Studio2019安装教程

    Visual Studio正式版早就可以使用了,但是好多小伙伴还是不会用,今天小编就给大家带来了最新的安装教程和激活方法. Visual Studio 2019包含社区版(Community).专业版 ...

  8. javascript增强typeof 对复杂类型的判断

    js中有六种数据类型,包括五种基本数据类型(Number,String,Boolean,Undefined,Null),和一种复杂数据类型(Object). typeof 由于js中的变量是松散类型的 ...

  9. Codeforces Round #609 (Div. 2) A-E简要题解

    contest链接:https://codeforces.com/contest/1269 A. Equation 题意:输入一个整数,找到一个a,一个b,使得a-b=n,切a,b都是合数 思路:合数 ...

  10. centos7 walle2瓦力部署教程

    项目部署上线,如果是单服务器,那么有多种方式可以部署,比如直接ftp上传,或者直接git去拉取,人工操作也不会花费精力和时间,但是如果采用了集群模式,有多台服务器,那么依靠一台一台的去上传代码,就显得 ...