Class SingularValueDecomposition

java.lang.Object
org.dulab.javanmf.algorithms.SingularValueDecomposition

public class SingularValueDecomposition
extends java.lang.Object
This class performs non-negative singular value decomposition: first, the singular value decomposition is performed; then, the non-negative matrices W and H are formed.

Based on C. Boutsidis and E. Gallopoulos, SVD based initialization: A head start for nonnegative matrix factorization

Examples for given matrix X and number of components Ncomponents

 
     final int num_points = matrixX.numRows;
     final int num_vectors = matrixX.numCols;

     DoubleMatrix matrixW = new DoubleMatrix(num_points, num_components);
     DoubleMatrix matrixH = new DoubleMatrix(num_components, num_vectors);

     SingularValueDecomposition decomposition = new SingularValueDecomposition(matrixX);
     decomposition.decompose(matrixW, matrixH);
  
Author:
Du-Lab Team dulab.binf@gmail.com
  • Constructor Summary

    Constructors 
    Constructor Description
    SingularValueDecomposition​(org.ejml.data.DMatrixRMaj x)
    Creates an instance of SingularValueDecomposition for given matrix
  • Method Summary

    Modifier and Type Method Description
    void decompose​(org.ejml.data.DMatrixRMaj w, org.ejml.data.DMatrixRMaj h)
    Performs non-negative singular value decomposition (NNDSVD) of matrix X.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • decompose

      public void decompose​(@Nonnull org.ejml.data.DMatrixRMaj w, @Nonnull org.ejml.data.DMatrixRMaj h) throws java.lang.IllegalArgumentException
      Performs non-negative singular value decomposition (NNDSVD) of matrix X.

      The parameters w and h contain the result of the decomposition.

      For details, see C. Boutsidis and E. Gallopoulos, SVD based initialization: A head start for nonnegative matrix factorization.

      Parameters:
      w - matrix of shape [Npoints, Ncomponents]
      h - matrix of shape [Ncomponents, Nvectors]
      Throws:
      java.lang.IllegalArgumentException - if the number of columns in matrix X is not equal to the number of rows in matrix H