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. 在CentOS上通过Docker方式安装Redis

    在CentOS上通过Docker方式安装Redis 首先保证已经安装docker. 拖拽redis镜像 docker pull redis 启动redis docker run -p 6379:637 ...

  2. Resharper快捷键使用

    1:   Alt+F7将你光标所在位置的变量的所有使用以列表的方式显示出来,显示结果的窗体可以像其他窗体那样停靠. 它的优点包括: 可以从所有使用中挑选只显示read usage或者write usa ...

  3. Winform中使用Reactivex代替BeginInvoke/Invoke来更新UI数据

    首先通过Nuget安装包System.Reactive. ReactiveX项目 Url: https://github.com/Reactive-Extensions/Rx.NET public p ...

  4. 关于button在td中时,zclip复制不能的问题

    是button的定位问题引起的,解决方案:套上div加上position:relative即可 <td> <div style="position:relative&quo ...

  5. jvm(n):JVM面试

    Jvm内存结构,一般是面试官对Java虚拟机这块考察的第一问. Java虚拟机的内存结构一般可以从线程共有和线程私有两部分起头作答,然后再详细说明各自的部分,类似树状结构的作答,好处就是思路清晰,面试 ...

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

  7. torch.cat拼接 stack拼接 分块chunk

    torch.cat拼接 stack拼接 分块chunk 待办 https://blog.csdn.net/qq_39709535/article/details/80803003 stack dim理 ...

  8. BZOJ1015[JSOI2008]星球大战starwar题解报告

    题目链接 考虑正序去除点去掉其所有连边十分复杂,可以倒序离线处理,每次新建一个点,连接其连边,用并查集统计联通块的个数. 附代码 #include<iostream> #include&l ...

  9. Iris配置

    package main import ( "github.com/kataras/iris" "os" "encoding/json" & ...

  10. 使用pdf.js显示pdf文件

    <script type="text/javascript" src="build/pdf.min.js"></script> < ...