Home»Documentation»Vector and Matrix Library User's Guide»Matrix Decompositions»Non-Negative Matrix Factorization

## Non-Negative Matrix Factorization (NMF) | Extreme Optimization Numerical Libraries for .NET Professional |

The Non-Negative Matrix Factorization (NMF) is a decomposition of a matrix into a product of two matrices

X = WH,

where all entries in W and H are positive or zero. When the inner dimension of the product (the number of columns of W) is less than the rank of X, then the product is only an approximation, and the factorization is sometimes referred to as the Approximative Non-Negative Matrix Factorization.

The non-negative matrix factorization is represented by the
NonNegativeMatrixFactorization

The NonNegativeMatrixFactorization

The Decompose method performs the actual decomposition using an alternating least squares algorithm. For large matrices, this method may take a long time to complete. This method is called by other methods as needed. You will rarely need to call it explicitly.

After the decomposition is computed, the LeftFactor and RightFactor properties return matrices that represent the non-negative factors.

var A = Matrix.CreateRandom(6, 4); var nnmf = new NonNegativeMatrixFactorization<double>(A, 3); nnmf.Decompose(); var left = nnmf.LeftFactor; var right = nnmf.RightFactor;

Unlike other matrix decompositions, the non-negative matrix factorization does not help with solving systems of equations or related operations. Although methods like Solve are defined, they simply delegate the work to the corresponding method on the base matrix.

Copyright Â© 2004-2023,
Extreme Optimization. All rights reserved.

*Extreme Optimization,* *Complexity made simple*, *M#*, and *M
Sharp* are trademarks of ExoAnalytics Inc.

*Microsoft*, *Visual C#, Visual Basic, Visual Studio*, *Visual
Studio.NET*, and the *Optimized for Visual Studio* logo

are
registered trademarks of Microsoft Corporation.