Non-negative matrix factorizations

A rank-k non-negative matrix factorization of an \(m \times n\) matrix \(A\) with all non-negative entries is a solution to the problem

\[\min_{X,Y} \| A - X Y \|_F, \text{ such that } X,Y \ge 0\]

where \(X\) is \(m \times k\) and \(Y\) is \(k \times n\).

The following routines employ alternating non-negative least squares algorithms.

Note

The following routines are still just prototypes and do not employ proper stopping criteria

Python API

NMF(A[, ctrl=None])
Parameters
  • A – dense, sequential or distributed matrix to approximate with NMF

  • ctrl – (optional) NNLSCtrl_s or NNLSCtrl_d control structure, depending upon whether the data is single-precision or double-precision

Return type

the two non-negative factors (which will have types compatible with that of A)

C++ API

void NMF(const Matrix<Real> &A, Matrix<Real> &X, Matrix<Real> &Y, const NNLSCtrl<Real> &ctrl = NNLSCtrl<Real>())
void NMF(const ElementalMatrix<Real> &A, ElementalMatrix<Real> &X, ElementalMatrix<Real> &Y, const NNLSCtrl<Real> &ctrl = NNLSCtrl<Real>())

C API

Standard interface

Single-precision

ElError ElNMF_s(ElConstMatrix_s A, ElMatrix_s X, ElMatrix_s Y)
ElError ElNMFDist_s(ElConstDistMatrix_s A, ElDistMatrix_s X, ElDistMatrix_s Y)

Double-precision

ElError ElNMF_d(ElConstMatrix_d A, ElMatrix_d X, ElMatrix_d Y)
ElError ElNMFDist_d(ElConstDistMatrix_d A, ElDistMatrix_d X, ElDistMatrix_d Y)

Expert interface

Single-precision

ElError ElNMFX_s(ElConstMatrix_s A, ElMatrix_s X, ElMatrix_s Y, ElNNLSCtrl_s ctrl)
ElError ElNMFXDist_s(ElConstDistMatrix_s A, ElDistMatrix_s X, ElDistMatrix_s Y, ElNNLSCtrl_s ctrl)

Double-precision

ElError ElNMFX_d(ElConstMatrix_d A, ElMatrix_d X, ElMatrix_d Y, ElNNLSCtrl_d ctrl)
ElError ElNMFXDist_d(ElConstDistMatrix_d A, ElDistMatrix_d X, ElDistMatrix_d Y, ElNNLSCtrl_d ctrl)