Nndsvd (methods.seeding.nndsvd)

Nonnegative Double Singular Value Decomposition (NNDSVD) [Boutsidis2007] is a new method designed to enhance the initialization stage of the nonnegative matrix factorization. The basic algorithm contains no randomization and is based on two SVD processes, one approximating the data matrix, the other approximating positive sections of the resulting partial SVD factors utilizing an algebraic property of unit rank matrices.

NNDSVD is well suited to initialize NMF algorithms with sparse factors. Numerical examples suggest that NNDSVD leads to rapid reduction of the approximation error of many NMF algorithms. By setting algorithm options :param:`flag` dense factors can be generated.

class nimfa.methods.seeding.nndsvd.Nndsvd

Bases: object

init_sparse(V, U, S, E)

Continue the NNDSVD initialization of sparse target matrix.

Parameters:
  • V (scipy.sparse of format csr, csc, coo, bsr, dok, lil, dia) – Target matrix
  • U (scipy.sparse of format csr, csc, coo, bsr, dok, lil, dia) – Left singular vectors.
  • E (scipy.sparse of format csr, csc, coo, bsr, dok, lil, dia) – Right singular vectors.
  • S (scipy.sparse of format csr, csc, coo, bsr, dok, lil, dia) – Singular values.
initialize(V, rank, options)

Return initialized basis and mixture matrix.

Initialized matrices are sparse scipy.sparse.csr_matrix if NNDSVD variant is specified by the :param:`flag` option, else matrices are numpy.matrix.

Parameters:
  • V (scipy.sparse of format csr, csc, coo, bsr, dok, lil, dia or numpy.matrix) – Target matrix, the matrix for MF method to estimate. Data instances to be clustered.
  • rank (int) – Factorization rank.
  • options (dict) –

    Specify the algorithm and model specific options (e.g. initialization of extra matrix factor, seeding parameters).

    Option flag indicates the variant of the NNDSVD algorithm. It can take value from:

    • 0 – NNDSVD,
    • 1 – NNDSVDa (fill in the zero elements with the average),
    • 2 – NNDSVDar (fill in the zero elements with random values in the space [0:average/100]).

    Default is NNDSVD. Because of the nature of NNDSVDa and NNDSVDar, when the target matrix is sparse, only NNDSVD is possible and flag is ignored (NNDSVDa and NNDSVDar eliminate zero elements, therefore the matrix is not sparse anymore).

Fork me on GitHub