from sklearn.decomposition import DictionaryLearning

#数据预处理字典学习DictionaryLearning模型
def test_DictionaryLearning():
X=[[1,2,3,4,5],
[6,7,8,9,10],
[10,9,8,7,6,],
[5,4,3,2,1]]
print("before transform:",X)
dct=DictionaryLearning(n_components=3)
dct.fit(X)
print("components is :",dct.components_)
print("after transform:",dct.transform(X)) # 调用 test_DictionaryLearning
test_DictionaryLearning()

from sklearn.decomposition import MiniBatchDictionaryLearning

#数据预处理字典学习MiniBatchDictionaryLearning模型
def test_MiniBatchDictionaryLearning():
X=[[1,2,3,4,5],
[6,7,8,9,10],
[10,9,8,7,6,],
[5,4,3,2,1]]
print("before transform:",X)
dct=DictionaryLearning(n_components=3)
dct.fit(X)
print("components is :",dct.components_)
print("after transform:",dct.transform(X)) # 调用 test_MiniBatchDictionaryLearning
test_MiniBatchDictionaryLearning()

吴裕雄 python 机器学习——数据预处理字典学习模型的更多相关文章

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

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

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

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

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

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

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

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

  5. 吴裕雄 python 机器学习——数据预处理流水线Pipeline模型

    from sklearn.svm import LinearSVC from sklearn.pipeline import Pipeline from sklearn import neighbor ...

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

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

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

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

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

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

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

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

随机推荐

  1. vue+muse-ui

    1.可以很好的配合vue2.0开发 2.安装: npm install  muse-ui --save 3.引入: 在main.js中加入 import Vue from 'vue' import M ...

  2. PP: Overviewing evolution patterns of egocentric networks by interactive construction of spatial layouts

    Problem: get an overall picture of how ego-networks evolve is a common challenging task. Existing te ...

  3. python3.0练习100题——001

    自学python3中,现在开始每天在python2.71 100例中做一道题,用python3实现,并写下一些思考-加油(ง •̀灬•́)ง 题目网站(http://www.runoob.com/py ...

  4. 阿里云MySQL安装到centos,并链接。

    Last login: Wed Jan 22 11:21:17 on ttys001 wulaguixiaomianyangdeMacBook-Pro:~ xingwen$ ssh root@47.9 ...

  5. wap网站开发小记(转载)

    一:网页的一些标记 1:声明 <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http ...

  6. mybatis(六):设计模式 - 装饰器模式

  7. AcWing 895. 最长上升子序列

    //设上升序列的最后一个数字为第i个,那么就以第i-1个位分类标准, //i-1可以没有,也可以是在数组中下标为1,下标为2 //一直到下标为i-1的数字 #include <iostream& ...

  8. AcWing 793. 高精度乘法

    https://www.acwing.com/problem/content/795/ #include<bits/stdc++.h> using namespace std; //A*b ...

  9. centos6 源码编译安装nginx 1.6 教程 nginx安装脚本

    操作系统centos 6.9 安装nginx需要pcre zlib openssl的库,下文都是在官网直接下载用作编译安装 该nginx安装教程,有安装maxmind IP 库 该教材有修改最大打开文 ...

  10. 关于我 & 关于这个博客

    关于我 OIer,初一在读,蒟蒻,普及组选手,只拿过两次PJ2=,实乃菜也 喜欢数学,OI,OI 上主要研究高级数据结构(如平衡树)和一些不那么暴力的算法(如分块) 打不动 CF . 关于这个博客 是 ...