码迷,mamicode.com
首页 > 其他好文 > 详细

scikit-learn:通过Non-negative matrix factorization (NMF or NNMF)实现LSA(隐含语义分析)

时间:2017-07-01 21:44:50      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:rand   get   部分   tran   ted   src   ==   cas   other   


之前写过两篇文章。各自是

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







scikit-learn:通过Non-negative matrix factorization (NMF or NNMF)实现LSA(隐含语义分析)

标签:rand   get   部分   tran   ted   src   ==   cas   other   

原文地址:http://www.cnblogs.com/mthoutai/p/7103483.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!