| 1 | <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 2 | <title>non-negative matrix factorization</title> |
| 3 | <style> |
| 4 | td { padding-left: 5pt; padding-right: 5pt; } |
| 5 | th { padding-left: 5pt; padding-right: 5pt; } |
| 6 | code { white-space: pre-wrap; } |
| 7 | dd { white-space: pre-wrap; } |
| 8 | </style> |
| 9 | </head><body bgcolor="#FFFFFF"> |
| 10 | |
| 11 | <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b> |
| 12 | non-negative matrix factorization |
| 13 | </b></font></table></table> |
| 14 | <p>The <b>non-negative matrix factorization</b><b></b> or <b>NMF</b> is a factorization of a data matrix <b><i>D</i></b>, whose elements are all non-negative, into a feature matrix <b><i>F</i></b> and a weights matrix <b><i>W</i></b> such that <b><i>D</i></b> ≈ <b><i>F</i></b> <b><i>W</i></b>, where the elements of <b><i>F</i></b> and <b><i>W</i></b> are also all non-negative.</p> |
| 15 | <h2>Algorithms for computing NMF</h2> |
| 16 | <p>More background on the algorithms used can be found in <a href="Berry_et_al___2007_.html">Berry et al. (2007)</a></p> |
| 17 | <p>The algorithms fall into three general classes:</p> |
| 18 | <dl> |
| 19 | <dt><b>1. Multiplicative updates</b>, |
| 20 | <dt><b>2. Alternating Least squares</b>, |
| 21 | <dt><b>3. Projected Gradient.</b> |
| 22 | </dl> |
| 23 | <h2>Multiplicative Updates</h2> |
| 24 | <code> initialize F and W<br></code> |
| 25 | <code> while iter < maxinter and not convergence<br></code> |
| 26 | <code> (MU) W = W .* (F'*D) ./ (F'*F*W + 10^^−9^)<br></code> |
| 27 | <code> (MU) F = F .* (D*W') ./ (F*W*W' + 10^^−9^)<br></code> |
| 28 | <code> test for convergence<br></code> |
| 29 | <code> endwhile<br></code> |
| 30 | <p>In the multiplicative update (MU) steps above "*" means ordinary matrix multiplication while ".*" and "./" mean elementwise matrix operations. The factors 10<sup>-9</sup> guard against division by zero.</p> |
| 31 | <h2>Alternating Least Squares</h2> |
| 32 | <p>The optimization of <b>D ≈ F*W</b> is not convex in both <b>F</b> and <b>W</b> it is convex in either <b>F</b> or <b>W</b>. Therefor given one, the other can be found by a simple least squares (LS) algorithm. This can be done in an alternating fashion.</p> |
| 33 | <p>The Aternating Least Squares (ALS) algorithm is as follows:</p> |
| 34 | <code> initialize F<br></code> |
| 35 | <code> while iter < maxinter and not convergence<br></code> |
| 36 | <code> (LS) Solve for W in matrix equation F'*F*W = F'*D<br></code> |
| 37 | <code> (NONNEG) Set all negative elements in W to 0<br></code> |
| 38 | <code> (LS) Solve for F in matrix equation W*W'*F' = W*D'<br></code> |
| 39 | <code> (NONNEG) Set all negative elements in F to 0<br></code> |
| 40 | <code> test for convergence<br></code> |
| 41 | <code> endwhile<br></code> |
| 42 | <p></p> |
| 43 | <ul> |
| 44 | <li><a href="Matrix__To_NMF__ALS____.html">Matrix: To NMF (ALS)...</a> |
| 45 | <li><a href="Matrix__To_NMF__IS____.html">Matrix: To NMF (IS)...</a> |
| 46 | <li><a href="Matrix__To_NMF__m_u_____.html">Matrix: To NMF (m.u.)...</a> |
| 47 | <li><a href="NMF.html">NMF</a> |
| 48 | </ul> |
| 49 | <hr> |
| 50 | <address> |
| 51 | <p>© djmw 20230801</p> |
| 52 | </address> |
| 53 | </body> |
| 54 | </html> |