scikit-learn:通过Non-negative matrix factorization (NMF or NNMF)实现LSA(隐含语义分析)...
之前寫過兩篇文章。各自是
1)矩陣分解的綜述:scikit-learn:2.5.矩陣因子分解問題
2)關(guān)于TruncatedSVD的簡介:scikit-learn:通過TruncatedSVD實(shí)現(xiàn)LSA(隱含語義分析)
今天發(fā)現(xiàn)NMF也是一個(gè)非常好非常有用的模型,就簡介一下。它也屬于scikit-learn:2.5.矩陣因子分解問題的一部分。
NMF是還有一種壓縮方法,前提是如果數(shù)據(jù)矩陣是非負(fù)的。
在數(shù)據(jù)矩陣不包括負(fù)值的情況下。?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。并優(yōu)化下式:
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通過增量式(通過疊加每個(gè)子成分而不做相減操作)的方式表示一個(gè)向量,這樣的增量式模型能有效表示圖像和文本。
NNMF實(shí)現(xiàn)了非負(fù)雙神秘值分解(?Nonnegative Double Singular Value Decomposition,NNDSVD)。NNDSVD基于兩個(gè)SVD過程。一個(gè)SVD過程用來近似數(shù)據(jù)矩陣,還有一個(gè)SVD過程利用單位秩矩陣的代數(shù)性質(zhì)來近似第一步產(chǎn)生的SVD因子的正值部分。NNDSVD的基本實(shí)現(xiàn)能非常好地用于稀疏矩陣分解。
對(duì)于非稀疏矩陣,能夠使用變形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)
這個(gè)樣例非常不錯(cuò)哦:
http://scikit-learn.org/stable/auto_examples/applications/topics_extraction_with_nmf.html#example-applications-topics-extraction-with-nmf-py
轉(zhuǎn)載于:https://www.cnblogs.com/mthoutai/p/7103483.html
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的scikit-learn:通过Non-negative matrix factorization (NMF or NNMF)实现LSA(隐含语义分析)...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ElasticSearch 索引模块——
- 下一篇: SegmentFault 巨献 1024