scikit-learn:通过Non-negative matrix factorization (NMF or NNMF)实现LSA(隐含语义分析)...
之前寫過兩篇文章。各自是
1)矩陣分解的綜述:scikit-learn:2.5.矩陣因子分解問題
2)關于TruncatedSVD的簡介:scikit-learn:通過TruncatedSVD實現LSA(隱含語義分析)
今天發現NMF也是一個非常好非常有用的模型,就簡介一下。它也屬于scikit-learn:2.5.矩陣因子分解問題的一部分。
NMF是還有一種壓縮方法,前提是如果數據矩陣是非負的。
在數據矩陣不包括負值的情況下。?NMF能夠取代PCA及他的變形(NMF?can be plugged in instead of?PCA?or its variants, in the cases where the data matrix does not contain negative values.)。
他通過把X分解成W和H。并優化下式:
This norm is an obvious extension of the Euclidean norm to matrices. (Other optimization objectives have been suggested in the NMF literature, in particular Kullback-Leibler divergence, but these are not currently implemented.)
和PCA不同的是。NNMF通過增量式(通過疊加每個子成分而不做相減操作)的方式表示一個向量,這樣的增量式模型能有效表示圖像和文本。
NNMF實現了非負雙神秘值分解(?Nonnegative Double Singular Value Decomposition,NNDSVD)。NNDSVD基于兩個SVD過程。一個SVD過程用來近似數據矩陣,還有一個SVD過程利用單位秩矩陣的代數性質來近似第一步產生的SVD因子的正值部分。NNDSVD的基本實現能非常好地用于稀疏矩陣分解。
對于非稀疏矩陣,能夠使用變形NNDSVDa (in which all zeros are set equal to the mean of all elements of the data)和NNDSVDar (in which the zeros are set to random perturbations less than the mean of the data divided by 100)
這個樣例非常不錯哦:
http://scikit-learn.org/stable/auto_examples/applications/topics_extraction_with_nmf.html#example-applications-topics-extraction-with-nmf-py
轉載于:https://www.cnblogs.com/mthoutai/p/7103483.html
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的scikit-learn:通过Non-negative matrix factorization (NMF or NNMF)实现LSA(隐含语义分析)...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ElasticSearch 索引模块——
- 下一篇: SegmentFault 巨献 1024