Main Content

Nonnegative matrix factorization

`[`

factors the `W`

,`H`

] = nnmf(`A`

,`k`

)*n*-by-*m* matrix `A`

into nonnegative factors `W`

(*n*-by-`k`

) and `H`

(`k`

-by-*m*). The factorization is not exact;
`W*H`

is a lower-rank approximation to `A`

.
The factors `W`

and `H`

minimize the root mean
square residual `D`

between `A`

and
`W*H`

.

`D = norm(A - W*H,'fro')/sqrt(n*m)`

The factorization uses an iterative algorithm starting with random initial values
for `W`

and `H`

. Because the root mean square
residual `D`

might have local minima, repeated factorizations might
yield different `W`

and `H`

. Sometimes the
algorithm converges to a solution of lower rank than *k*, which can
indicate that the result is not optimal.

`[`

modifies the factorization using one or more name-value pair arguments. For example,
you can request repeated factorizations by setting `W`

,`H`

] = nnmf(`A`

,`k`

,`Name,Value`

)`'Replicates'`

to an integer value greater than 1.

[1] Berry, Michael W., Murray
Browne, Amy N. Langville, V. Paul Pauca, and Robert J. Plemmons. “Algorithms and
Applications for Approximate Nonnegative Matrix Factorization.” *Computational
Statistics & Data Analysis* 52, no. 1 (September 2007): 155–73. https://doi.org/10.1016/j.csda.2006.11.006.