from sklearn.preprocessing import Binarizer

#数据预处理二元化Binarizer模型
def test_Binarizer():
X=[[1,2,3,4,5],
[5,4,3,2,1],
[3,3,3,3,3,],
[1,1,1,1,1]]
print("before transform:",X)
binarizer=Binarizer(threshold=2.5)
print("after transform:",binarizer.transform(X)) # 调用 test_Binarizer
test_Binarizer()

吴裕雄 python 机器学习——数据预处理二元化Binarizer模型的更多相关文章

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

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

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

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

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

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

  4. 吴裕雄 python 机器学习——数据预处理嵌入式特征选择

    import numpy as np import matplotlib.pyplot as plt from sklearn.svm import LinearSVC from sklearn.li ...

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

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

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

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

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

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

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

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

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

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

随机推荐

  1. Oracle库基本操作

    --oracle 获取表名称,字段 with vA as ( SELECT USER_TAB_COLS.TABLE_NAME as 表名,USER_TAB_COLS.COLUMN_NAME as 列名 ...

  2. [TJOI2013] 拯救小矮人- 贪心,dp

    结论:矮的人比高的人先走一定不会使得答案变劣 于是我们排序后,像 0-1 背包那样依次考虑每个人走不走 #include <bits/stdc++.h> using namespace s ...

  3. ubuntu18.04 编译fortran出现 ‘没有f951这个文件’处理

    机器自带了gcc所以可以编译fortran文件, 使用时, gcc **.for –o ***.out 提示,没有找到f951. 然后去网上找解决方案,有的人说在其他地方找到了f951,然后把他复制到 ...

  4. spring security和java web token整合

    思路: spring security 1.用户输入用户名密码. 2.验证:从库中(可以是内存.数据库等)查询该用户的密码.角色,验证用户名和密码是否正确.如果正确,则将填充Authenticatio ...

  5. 2019-08-15 纪中NOIP模拟B组

    T1 [JZOJ3455] 库特的向量 题目描述 从前在一个美好的校园里,有一只(棵)可爱的弯枝理树.她内敛而羞涩,一副弱气的样子让人一看就想好好疼爱她.仅仅在她身边,就有许多女孩子想和她BH,比如铃 ...

  6. 巨杉内核笔记(一)| SequoiaDB 会话(session)简介

    SequoiaDB 会话(session)简介 会话(Session)的基本概念 容易弄混淆的两个概念是会话与连接. 通俗来讲,会话(Session) 是通信双方从开始通信到通信结束期间的一个上下文( ...

  7. 洛谷P1223 排队接水

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

  8. Python之路Day02

    一.While while -- 循环 while 条件: 循环体 break -- 终止当前循环 while True:    print("爱情买卖")    break   ...

  9. C++-随机数的产生

    一.随机数 以前学C语言的时候感觉随机数没啥用的,现在想想是自己无知啦,在帮人做一个项目的时候发现随机数还是相当有用的,我们可以利用随机数来生成大量的测试数据. 有两种方法可以让你的程序每次运行结果不 ...

  10. 从原理到方案,一步步讲解web移动端实现自适应等比缩放

    前言 在移动端做自适应,我们常用的有媒体查询,rem ,em,宽度百分比这几种方案.但是都各有其缺点. 首先拿媒体查询来说,在某一个宽度区间内只能使用一种样式,为了适应不同屏幕要,css的代码量就会增 ...