Class PartialSingularValueDecomposition

  • All Implemented Interfaces:
    MatrixFactorization

    public class PartialSingularValueDecomposition
    extends Object
    implements MatrixFactorization
    Performs matrix factorization using the Singular Value Decomposition algorithm.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.carrot2.math.mahout.matrix.DoubleMatrix2D A
      Input matrix
      protected static int DEFAULT_K
      The default number of desired base vectors
      protected int k
      The desired number of base vectors
      protected org.carrot2.math.mahout.matrix.DoubleMatrix2D U
      Base vector result matrix
      protected org.carrot2.math.mahout.matrix.DoubleMatrix2D V
      Coefficient result matrix
    • Constructor Summary

      Constructors 
      Constructor Description
      PartialSingularValueDecomposition​(org.carrot2.math.mahout.matrix.DoubleMatrix2D A)
      Computes a partial SVD of a matrix.
    • Field Detail

      • k

        protected int k
        The desired number of base vectors
      • DEFAULT_K

        protected static final int DEFAULT_K
        The default number of desired base vectors
        See Also:
        Constant Field Values
      • A

        protected org.carrot2.math.mahout.matrix.DoubleMatrix2D A
        Input matrix
      • U

        protected org.carrot2.math.mahout.matrix.DoubleMatrix2D U
        Base vector result matrix
      • V

        protected org.carrot2.math.mahout.matrix.DoubleMatrix2D V
        Coefficient result matrix
    • Constructor Detail

      • PartialSingularValueDecomposition

        public PartialSingularValueDecomposition​(org.carrot2.math.mahout.matrix.DoubleMatrix2D A)
        Computes a partial SVD of a matrix. Before accessing results, perform computations by calling the compute()method.
        Parameters:
        A - matrix to be factorized
    • Method Detail

      • compute

        public void compute()
        Computes the factorization.
      • getSingularValues

        public double[] getSingularValues()
        Returns singular values of the matrix.
      • setK

        public void setK​(int k)
        Sets the number of base vectors k .
        Parameters:
        k - the number of base vectors
      • getK

        public int getK()
        Returns the number of base vectors k .
      • getU

        public org.carrot2.math.mahout.matrix.DoubleMatrix2D getU()
        Description copied from interface: MatrixFactorization
        Returns the U matrix (base vectors matrix).
        Specified by:
        getU in interface MatrixFactorization
        Returns:
        U matrix
      • getV

        public org.carrot2.math.mahout.matrix.DoubleMatrix2D getV()
        Description copied from interface: MatrixFactorization
        Returns the V matrix (coefficient matrix)
        Specified by:
        getV in interface MatrixFactorization
        Returns:
        V matrix