zoukankan      html  css  js  c++  java
  • 吴裕雄 python 机器学习——数据预处理字典学习模型

    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() 

  • 相关阅读:
    iOS~runtime理解上篇
    iOS
    iOS-数据库+上传队列+runtime
    python3
    必应壁纸破解下载
    python3-django Mac下安装以及查看路径
    iOS
    iOS
    Tornado异步之-协程与回调
    iOS
  • 原文地址:https://www.cnblogs.com/tszr/p/10802189.html
Copyright © 2011-2022 走看看