Non-negative Matrix Factorization 非負矩陣分解

Non-negative Matrix Factorization 非負矩陣分解

Introduction

定義

  非負矩陣分解(non-negative matrix factorization),或非負矩陣近似(non-negative matrix approximation),是多變量分析和線性代數的算法。給定非負矩陣,求兩個非負矩陣和,使得。

起源

  著名的科學雜誌《Nature》於1999年刊登了兩位科學家D.D.Lee和H.S.Seung對數學中非負矩陣研究的突出成果。該文提出了一種新的矩陣分解思想——非負矩陣分解(Non-negative Matrix Factorization,NMF)算法,即NMF是在矩陣中所有元素均爲非負數約束條件之下的矩陣分解方法。

優點

  1. 處理大規模數據更快更便捷;
  2. 實現簡便性、分解形式和分解結果上的可解釋性,佔用存儲空間少。

缺點

  1. NMF中只用一層表示隱變量,無法處理複雜學習問題;
  2. NMF只約束了和的非負性(這是唯一先驗,只要求滿足這個),而沒有考慮到對於該先驗,內部元素間的相關性。(如圖1中NMF部分的第1列第5行與第4列第7行類似,這二者的線性組合表示眼睛,而NMF假設他們不相關。)

應用領域

  計算機視覺,文檔聚類,化學統計學,音頻信號處理,推薦系統

整體比較

  利用矩陣分解來解決實際問題的分析方法很多,如PCA(主成分分析)、ICA(獨立成分分析)、SVD(奇異值分解)、VQ(矢量量化)等。 
  這些方法的共同特點是,和中的元素可爲正或負,即使輸入的初始矩陣元素是全正的,傳統的秩削減算法也不能保證原始數據的非負性。 
  在數學上,從計算的觀點看,分解結果中存在負值是正確的,但負值元素在實際問題中往往是沒有意義的。例如圖像數據中不可能有負值的像素點;在文檔統計中,負值也是無法解釋的。

具體比較

  在VQ分解中,每一列的被約束爲一個一元矢量。其中只有一個元素爲1,其他元素爲0。若的第一列中,第個元素爲1,那麼中第一列的臉,就完全由基圖像中的第列數據表示。此時得到的基圖像稱爲原型基圖像,這些原型圖像表示一張原型臉(whole-face prototypes)。 
  在PCA分解中,的各列之間相互正交,各行之間相互正交。這個約束比VQ的鬆弛很多,也就是,中的元素可爲正也可爲負。中每一張臉的每一個像素點都是中各列對應的像素點的一個加權和。由於權重矩陣中元素符號的任意性,所以基矩陣表示出來並不像VQ中原型臉那樣的直觀可解釋。此時將W的列數據畫出來並不一定能直接看到一張“臉”。但是在統計上可以解釋爲最大方差方向,我們把這些“臉”稱爲“特徵臉”(distorted versions of whole faces)。 
  在NMF中,由於加了非負約束。與VQ的單一元素不爲0不同,NMF允許基圖像H間的加權結合來表示臉部圖像V;與PCA不同,NMF的加權係數H中的元素都爲非負的。前兩者得到的都是一個完整的臉部特徵基圖像,而NMF得到的是臉部 子特徵(localized features)。 
  通俗點說,VQ是用一張完整的圖像直接代表源臉部圖像;PCA是將幾個完整人臉加減壓成一張臉;而NMF是取甲的眼睛,乙的鼻子,丙的嘴巴直接拼成一張臉。這樣解釋雖然細節上略有不妥,但不失其概念上的意義。 
  圖1 
  圖1 第一列爲矩陣組成的圖像。其中每一個小格爲的一列的個元素重構而成的的矩陣圖像。第二列爲矩陣,其中紅色表示負數,灰黑表示正數, 顏色程度表示大小。右邊的圖像只是矩陣的一列的個元素組成的一張原始臉。

Approach

  有很多方法可以求和,其中Lee和Seung的倍增更新法則因爲實現簡單,是最流行的方法。 
  一些成功的算法是基於交替非負最小二乘法:在每一步中,首先固定並通過非負最小二乘法求解法得到,然後固定同理求出。求解或的方法可以相同或不同,因爲可以對或進行規範化(以防止過擬合)。具體求解方法包括the projected gradient descent methods(投影梯度下降方法),the active set method 和 the block principal pivoting method。

Lee和Seung的倍增更新法則

分解的公式: 


其中是分解矩陣的秩,是原矩陣的一個近似,與就是分解而成的兩個矩陣。 
優化目標函數爲 

其中表示一個像素,由泊松噪聲的而得。因此目標函數實際上表示由基和編碼產生圖像的概率。 
用迭代算法求和,初始時是隨機矩陣,然後不斷迭代更新,使得達到一個局部極大值: 

 

 

Implementation

python

  • nimfa - A Python Library for Nonnegative Matrix Factorization Techniques 
    http://nimfa.biolab.si/
  • http://www.csie.ntu.edu.tw/~cjlin/nmf/ 
    給定和的初始矩陣,收斂時的容忍值(tolerance),時間限制,迭代次數限制,返回分解的非負矩陣和。
  • nmf.py
  • # NMF by alternative non-negative least squares using projected gradients
    # Author: Chih-Jen Lin, National Taiwan University
    # Python/numpy translation: Anthony Di Franco
     
    from numpy import *
    from numpy.linalg import norm
    from time import time
    from sys import stdout
     
    def nmf(V,Winit,Hinit,tol,timelimit,maxiter):
     """
     (W,H) = nmf(V,Winit,Hinit,tol,timelimit,maxiter)
     W,H: output solution
     Winit,Hinit: initial solution
     tol: tolerance for a relative stopping condition
     timelimit, maxiter: limit of time and iterations
     """
     
     W = Winit; H = Hinit; initt = time();
     
     gradW = dot(W, dot(H, H.T)) - dot(V, H.T)
     gradH = dot(dot(W.T, W), H) - dot(W.T, V)
     initgrad = norm(r_[gradW, gradH.T])
     print 'Init gradient norm %f' % initgrad 
     tolW = max(0.001,tol)*initgrad
     tolH = tolW
     
     for iter in xrange(1,maxiter):
      # stopping condition
      projnorm = norm(r_[gradW[logical_or(gradW<0, W>0)],
                                     gradH[logical_or(gradH<0, H>0)]])
      if projnorm < tol*initgrad or time() - initt > timelimit: break
     
      (W, gradW, iterW) = nlssubprob(V.T,H.T,W.T,tolW,1000)
      W = W.T
      gradW = gradW.T
     
      if iterW==1: tolW = 0.1 * tolW
     
      (H,gradH,iterH) = nlssubprob(V,W,H,tolH,1000)
      if iterH==1: tolH = 0.1 * tolH
     
      if iter % 10 == 0: stdout.write('.')
     
     print '\nIter = %d Final proj-grad norm %f' % (iter, projnorm)
     return (W,H)
     
    def nlssubprob(V,W,Hinit,tol,maxiter):
     """
     H, grad: output solution and gradient
     iter: #iterations used
     V, W: constant matrices
     Hinit: initial solution
     tol: stopping tolerance
     maxiter: limit of iterations
     """
     
     H = Hinit
     WtV = dot(W.T, V)
     WtW = dot(W.T, W) 
     
     alpha = 1; beta = 0.1;
     for iter in xrange(1, maxiter):  
      grad = dot(WtW, H) - WtV
      projgrad = norm(grad[logical_or(grad < 0, H >0)])
      if projgrad < tol: break
     
      # search step size 
      for inner_iter in xrange(1,20):
       Hn = H - alpha*grad
       Hn = where(Hn > 0, Hn, 0)
       d = Hn-H
       gradd = sum(grad * d)
       dQd = sum(dot(WtW,d) * d)
       suff_decr = 0.99*gradd + 0.5*dQd < 0;
       if inner_iter == 1:
        decr_alpha = not suff_decr; Hp = H;
       if decr_alpha: 
        if suff_decr:
         H = Hn; break;
        else:
         alpha = alpha * beta;
       else:
          if not suff_decr or (Hp == Hn).all():
           H = Hp; break;
          else:
           alpha = alpha/beta; Hp = Hn;
     
      if iter == maxiter:
       print 'Max iter in nlssubprob'
     return (H, grad, iter)
    

     


Applications

圖像分析

  NMF最成功的一類應用是在圖像的分析和處理領域。圖像本身包含大量的數據,計算機一般將圖像的信息按照矩陣的形式進行存放,針對圖像的識別、分析和處理也是在矩陣的基礎上進行的。這些特點使得NMF方法能很好地與圖像分析處理相結合。人們已經利用NMF算法,對衛星發回的圖像進行處理,以自動辨別太空中的垃圾碎片;使用NMF算法對天文望遠鏡拍攝到的圖像進行分析,有助於天文學家識別星體;美國還嘗試在機場安裝由NMF算法驅動的識別系統,根據事先輸入計算機的恐怖分子的特徵圖像庫來自動識別進出機場的可疑恐怖分子。

文本聚類/數據挖掘

  文本在人類日常接觸的信息中佔有很大分量,爲了更快更精確地從大量的文本數據中取得所需要的信息,針對文本信息處理的研究一直沒有停止過。文本數據不光信息量大,而且一般是無結構的。此外,典型的文本數據通常以矩陣的形式被計算機處理,此時的數據矩陣具有高維稀疏的特徵,因此,對大規模文本信息進行處理分析的另一個障礙便是如何削減原始數據的維數。NMF算法正是解決這方面難題的一種新手段。NMF在挖掘用戶所需數據和進行文本聚類研究中都有着成功的應用例子。由於NMF算法在處理文本數據方面的高效性,著名的商業數據庫軟件Oracle在其第10版中專門利用NMF算法來進行文本特徵的提取和分類。爲什麼NMF對於文本信息提取得很好呢?原因在於智能文本處理的核心問題是以一種能捕獲語義或相關信息的方式來表示文本,但是傳統的常用分析方法僅僅是對詞進行統計,而不考慮其他的信息。而NMF不同,它往往能達到表示信息的局部之間相關關係的效果,從而獲得更好的處理結果。

語音處理

  語音的自動識別一直是計算機科學家努力的方向,也是未來智能應用實現的基礎技術。語音同樣包含大量的數據信息,識別語音的過程也是對這些信息處理的過程。NMF算法在這方面也爲我們提供了一種新方法,在已有的應用中,NMF算法成功實現了有效的語音特徵提取,並且由於NMF算法的快速性,對實現機器的實時語音識別有着促進意義。也有使用NMF方法進行音樂分析的應用。復調音樂的識別是個很困難的問題,三菱研究所和MIT(麻省理工學院)的科學家合作,利用NMF從演奏中的復調音樂中識別出各個調子,並將它們分別記錄下來。實驗結果表明,這種採用NMF算法的方法不光簡單,而且無須基於知識庫。

機器人控制

  如何快速準確地讓機器人識別周圍的物體對於機器人研究具有重要的意義,因爲這是機器人能迅速作出相應反應和動作的基礎。機器人通過傳感器獲得周圍環境的圖像信息,這些圖像信息也是以矩陣的形式存儲的。已經有研究人員採用NMF算法實現了機器人對周圍對象的快速識別,根據現有的研究資料顯示,識別的準確率達到了80%以上。

生物醫學工程和化學工程

  生物醫學和化學研究中,也常常需要藉助計算機來分析處理試驗的數據,往往一些煩雜的數據會耗費研究人員的過多精力。NMF算法也爲這些數據的處理提供了一種新的高效快速的途徑。科學家將NMF方法用於處理核醫學中的電子發射過程的動態連續圖像,有效地從這些動態圖像中提取所需要的特徵。NMF還可以應用到遺傳學和藥物發現中。因爲NMF的分解不出現負值,因此採用NMF分析基因DNA的分子序列可使分析結果更加可靠。同樣,用NMF來選擇藥物成分還可以獲得最有效的且負作用最小的新藥物。 
  此外,NMF算法在環境數據處理、信號分析與複雜對象的識別方面都有着很好的應用。近年來採用NMF思想的應用纔剛展開,相信以後會有更多的成功應用。這些成功的應用反過來也將促進NMF的進一步研究。

Reference

  1. Daniel D. Lee and H. Sebastian Seung (1999). “Learning the parts of objects by non-negative matrix factorization”. Nature 401 (6755): 788–791. doi:10.1038/44565. PMID 10548103.
  2. Daniel D. Lee and H. Sebastian Seung (2001). Algorithms for Non-negative Matrix Factorization. Advances in Neural Information Processing Systems 13: Proceedings of the 2000 Conference. MIT Press. pp. 556–562.
  3. https://en.wikipedia.org/wiki/Non-negative_matrix_factorization
  4. 汪鵬.非負矩陣分解:數學的奇妙力量.《計算機教育》2004年第10期.http://blog.sciencenet.cn/blog-248606-466811.html
  5. Chih-Jen Lin(libSVM的作者).NMF工具.http://www.csie.ntu.edu.tw/~cjlin/nmf/
  6. Matlab文檔nnmf.http://cn.mathworks.com/help/stats/nnmf.html
  7. Rachel Zhang.http://blog.csdn.net/abcjennifer/article/details/8579104

Read List

http://blog.sciencenet.cn/blog-795427-629574.html

1994_Environmeteics_Positive matrix factorization A non-negative factor model with optimal utilization of error estimates of data values.pdf 
1997_JM_A fast non-negativity-constrained least squares algorithm.pdf 
1999_nature_Learning the parts of objects by non-negative matrix factorization.pdf 
2000_IEEE_Normalized Cuts and Image Segmentation.pdf 
2001_NIPS_Algorithms for non-negative matrix factorization.pdf 
2001_CVPR_Learning Spatially Localized, Parts-B ased Representation.pdf 
2001_PSUTR_Spectral Relaxation Models And Structure Analysis For K-Way Graph Clustering And Bi-Clustering .pdf 
2001_WI_ICA.pdf 
2002_IEEE_Algorithms for Non-Negative Independent Component Analysis .pdf 
2002_NIPS_Spectral relaxation for K-means clustering.pdf 
2002_NNSP_non-negative sparse coding.pdf 
2003_ICASSP_NON-NEGATIVE MATRIX FACTORIZATION FOR VISUAL CODING.pdf 
2004_NIPS_When Does Non-Negative Matrix Factorization give a correct Decomposition into parts.pdf 
2004_Non-negative Matrix Factorization with Sparseness Constraints.pdf 
2004_On reduced rank nonnegative matrix factorization for symmetric nonnegative matrices.pdf 
2005-IEEE-Sparse image coding using a 3D non-negative tensor factorization.pdf 
2005_ECML_Nonnegative Lagrangian Relaxation of K-Means and Spectral Clustering.pdf 
2005_On the Equivalence of Nonnegative Matrix Factorization and Spectral Clustering.pdf 
2005_ISSTECH_ Projected Gradient Methods for Non-negative Matrix Factorization.pdf 
2005_SCIA_Projective Nonnegative Matrix Factorization for Image Compression and Feature Extraction.pdf 
2006-IEEE-SOUND SOURCE SEPARATION USING SHIFTED NON-NEGATIVE TENSOR.pdf 
2006_ACM_Orthogonal Nonnegative Matrix Tri-Factorizations for Clustering.pdf 
2006_ICAISCP_Non-negative matrix factorization with quasi-Newton optimization.pdf 
2006_ICDM_The Relationships Among Various Nonnegative Matrix Factorization Methods for Clustering.pdf 
2006_IEEE_Convex and Semi-Nonnegative Matrix Factorizations.pdf 
2006_IEEE_Nonsmooth nonnegative matrix factorization.pdf 
2006_LAA_Nonnegative matrix factorization for spectraldata analysis.pdf 
2006_Nonnegative matrix factorization for spectral data analysis.pdf 
2007-ISSN-Regularized Alternating Least Squares Algorithms for Non-negative MatrixTensor Factorization.pdf 
2007_CSDA_Algorithms and applications for approximate nonnegative matrix factorization.pdf 
2007_ICDM_Solving Consensus and Semi-supervised Clustering Problems Using Nonnegative Matrix Factorization.pdf 
2007_NC_Projected Gradient Methods for Nonnegative Matrix Factorization.pdf 
2007_VLSI_Non-negative Matrix Factorization with Orthogonality Constraints and its Application to Raman Spectroscopy.pdf 
2008_ICDM_Non-negative Matrix Factorization on Manifold.pdf 
2008_ICDM_Nonnegative Matrix Factorization for Combinatorial Optimization Spectral Clustering Graph Matching and Clique Finding.pdf 
2008_IJCNN_Algorithms for orthogonal nonnegative matrix factorization.pdf 
2008_PR_SVD based initialization A head start for nonnegative matrix factorization.pdf 
2008_SIAM_ Nonnegative Matrix FactorizationBased on Alternating Nonnegativity Constrained Least Squares and Active Set Method.pdf 
2008_Non-negative matrix factorization for semi-supervised data clustering.pdf 
2008_SIAM_ Fast Newton-type methods for the least squares nonneg-ative matrix approximation problem.pdf 
2008_SIAM_Semi-Supervised Clustering via Matrix Factorization.pdf 
2010_AAAI_Non-Negative Matrix Factorization with Constraints.pdf 
2010_ECML_Improved MinMax Cut Graph Clustering with Nonnegative Relaxation.pdf 
2010_Extended Semi-supervised Matrix Factorization for Clustering.pdf 
2010_ICDM_Integrating Symmetric Nonnegative Matrix Factorization and Normalized Cut Spectral Clustering.pdf 
2010_Semi-Supervised Nonnegative Matrix Factorization.pdf 
2011-JCAM-A multilevel approach for nonnegative matrix factorization.pdf 
2011-SADM-Non-Negative Residual Matrix Factorization.pdf 
2011_AMC_An alternating projected gradient algorithm for nonnegative matrix factorization.pdf 
2011_CIKM_Simultaneous Clustering of Multi-Type Relational Data via symmetric nonnegative matrix tri-factorization.pdf 
2011_ICDM_Learning Spectral Embedding for Semi-supervised Clustering.pdf 
2011_IEEE_Symmetric Nonnegative Matrix Factorization:Algorithms and Applications to Probabilistic.pdf 
2012-ICAISC-Initialization of Nonnegative Matrix.pdf 
2012-IEEE-Coupled Nonnegative Matrix Factorization Unmixing.pdf 
2012-IWSSIP-AUTOMATIC CYMBAL CLASSIFICATION.pdf 
2012-JMLR-MahNMF:Manhattan Non-negative Matrix Factorization.pdf 
2012-LSJ-Image Denoising based on Sparse Representation and Non-Negative Matrix Factorization.pdf 
2012_ICNIP_Adaptive Multiplicative Updates for Projective Nonnegative Matrix Factorization.pdf 
2012_ICONIP_Adaptive Multiplicative Updates for Projective Nonnegative Matrix Factorization.pdf 
2012-CORR-Two Algorithms for Orthogonal Nonnegative Matrix Factorization with Application to Clustering.pdf 
Nonnegative Matrix Factorization for Clustering(概述).pdf

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章