吳裕雄 python 機器學習——數據預處理字典學習模型
阿新 • • 發佈:2019-05-02
sklearn 數據預處理 tran imp cti 圖片 component ict form
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_MiniBatchDictionaryLearningtest_MiniBatchDictionaryLearning()
吳裕雄 python 機器學習——數據預處理字典學習模型