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. ORA-00904: "I_LEVEL": invalid identifier

    问题描述 ORA-00904: "I_LEVEL": invalid identifier 标示符无效

  2. django--关于部署scrapyd项目报错问题

    首先在同步两篇之前写过的博客,可能能用得到 1.https://www.cnblogs.com/lutt/p/10893192.html2.https://www.cnblogs.com/lutt/p ...

  3. 搭建Hexo实现个人网站详细教程

    全网最全小白搭建Hexo+Gitee/Coding/Github 全网最全小白搭建Hexo+Gitee/Coding/Github 本站内容已全部转移到https://www.myyuns.ltd,具 ...

  4. Java连载83-单向链表、双向链表、collections常用方法

    一.单向链表 1.单向链表:每个元素都称为节点(Entry),每个节点都由两部分组成 2.单向链表的注意点: (1)单向链表每一个节点在内存中存储上在空间位置上是无规律的: (2)为什么单向链表的查询 ...

  5. mybatis-plus 错误

    错误:java.lang.NoClassDefFoundError: org/apache/velocity/context/Context 原因: 缺少velocity的依赖 解决方案: <d ...

  6. 转载:声音分贝的概念,dBSPL.dBFS

    转自:https://www.cnblogs.com/wangguchangqing/p/5947659.html 分贝 Decibel 分贝(dB)是一个对数单位(logarithmic unit) ...

  7. JavaScript对象之对象标签和对象序列化

    对象标签有三种:proto.class和extensible. 一.proto标签 例如我新建了一个person对象,那么其__proto__则指向Person.prototype,然后Person. ...

  8. 30分钟编写一个抓取 Unsplash 图片的 Python爬虫

       我一直想用 Python and Selenium 创建一个网页爬虫,但从来没有实现它. 几天前, 我决定尝试一下,这听起来可能是挺复杂的, 然而编写代码从 Unsplash 抓取一些美丽的图片 ...

  9. office2013激活工具,可以激活新版本office 2013

    耽误一上午没激活成功,最后还是找到了激活文件KMSpico v9.0.6.zip 链接:https://pan.baidu.com/s/1WEyJm8kVnqDONRJRHTRQiQ 提取码:4h45 ...

  10. js的基本分类(0.1)

    js分内嵌,内联,外部样式表三种, js的组成分,ES(变量,函数,对象,数组,判断,循环),BOM(浏览器对象模型),DOM(文档对象模型), js的五种输出语句,alert(警告框),confir ...