Class MatrixRegression

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

public class MatrixRegression
extends java.lang.Object
This class performs non-negative matrix regression: for given matrices X and W, find matrix H that minimizes the objective function

  D(X, WH) + λ||H||1 + 0.5 μ||H||2

where D(X, WH) is either the euclidean distance or the Kullback-Leibler divergence, ||·|| is the Frobenius norm, and ||·||1 is the l1-norm.

Example for given matrices matrixX and matrixW, matrix matrixH is modified to minimize the euclidean distance.

 
     UpdateRule updateRule = new MUpdateRule(0.0, 0.0);

     MatrixRegression regression = new MatrixRegression(updateRule, 1e-6, 10000);

     matrixH = regression.solve(matrixX, matrixW);
  
Author:
Du-Lab Team dulab.binf@gmail.com
  • Constructor Summary

    Constructors 
    Constructor Description
    MatrixRegression​(UpdateRule updateRule, double tolerance, int maxIteration)
    Creates an instance of MatrixRegression
  • Method Summary

    Modifier and Type Method Description
    org.ejml.data.DMatrixRMaj solve​(org.ejml.data.DMatrixRMaj x, org.ejml.data.DMatrixRMaj w, org.ejml.data.DMatrixRMaj h)
    Performs non-negative matrix regression
    org.ejml.data.DMatrixRMaj solve​(org.ejml.data.DMatrixRMaj x, org.ejml.data.DMatrixRMaj w, org.ejml.data.DMatrixRMaj h, boolean verbose)
    Performs non-negative matrix regression
    org.ejml.data.DMatrixRMaj solve​(org.ejml.data.DMatrixRMaj x, org.ejml.data.DMatrixRMaj w, org.ejml.data.DMatrixRMaj h, org.ejml.data.DMatrixRMaj limit)
    Performs non-negative matrix regression with the upper limit constraint
    org.ejml.data.DMatrixRMaj solve​(org.ejml.data.DMatrixRMaj x, org.ejml.data.DMatrixRMaj w, org.ejml.data.DMatrixRMaj h, org.ejml.data.DMatrixRMaj limit, boolean verbose)
    Performs non-negative matrix regression with the upper limit constraint

    Methods inherited from class java.lang.Object

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

    • MatrixRegression

      public MatrixRegression​(@Nonnull UpdateRule updateRule, double tolerance, int maxIteration)
      Creates an instance of MatrixRegression
      Parameters:
      updateRule - instance of UpdateRule for matrix H
      tolerance - the fitting error tolerance
      maxIteration - maximum number of iterations to use
  • Method Details

    • solve

      public org.ejml.data.DMatrixRMaj solve​(@Nonnull org.ejml.data.DMatrixRMaj x, @Nonnull org.ejml.data.DMatrixRMaj w, @Nonnull org.ejml.data.DMatrixRMaj h, @Nonnull org.ejml.data.DMatrixRMaj limit, boolean verbose)
      Performs non-negative matrix regression with the upper limit constraint
      Parameters:
      x - matrix of shape [Npoints, Nvectors], a collection of vectors in Npoints-dimensional space
      w - matrix of shape [Npoints, Ncomponents], a collection of components
      h - matrix of shape [Ncomponents, Nvectors], a collection of the decomposition coefficients
      limit - matrix of shape [Ncomponents, Nvectors], the upper limit for matrix H
      verbose - flag to output verbose information
      Returns:
      matrix H of shape [Ncomponents, Nvectors]
    • solve

      public org.ejml.data.DMatrixRMaj solve​(@Nonnull org.ejml.data.DMatrixRMaj x, @Nonnull org.ejml.data.DMatrixRMaj w, @Nonnull org.ejml.data.DMatrixRMaj h, @Nonnull org.ejml.data.DMatrixRMaj limit)
      Performs non-negative matrix regression with the upper limit constraint
      Parameters:
      x - matrix of shape [Npoints, Nvectors], a collection of vectors in Npoints-dimensional space
      w - matrix of shape [Npoints, Ncomponents], a collection of components
      h - matrix of shape [Ncomponents, Nvectors], a collection of the decomposition coefficients
      limit - matrix of shape [Ncomponents, Nvectors], the upper limit for matrix H
      Returns:
      matrix H of shape [Ncomponents, Nvectors]
    • solve

      public org.ejml.data.DMatrixRMaj solve​(@Nonnull org.ejml.data.DMatrixRMaj x, @Nonnull org.ejml.data.DMatrixRMaj w, @Nonnull org.ejml.data.DMatrixRMaj h, boolean verbose)
      Performs non-negative matrix regression
      Parameters:
      x - matrix of shape [Npoints, Nvectors], a collection of vectors in Npoints-dimensional space
      w - matrix of shape [Npoints, Ncomponents], a collection of components
      h - matrix of shape [Ncomponents, Nvectors], a collection of the decomposition coefficients
      verbose - flag to output verbose information
      Returns:
      matrix H of shape [Ncomponents, Nvectors]
    • solve

      public org.ejml.data.DMatrixRMaj solve​(@Nonnull org.ejml.data.DMatrixRMaj x, @Nonnull org.ejml.data.DMatrixRMaj w, @Nonnull org.ejml.data.DMatrixRMaj h)
      Performs non-negative matrix regression
      Parameters:
      x - matrix of shape [Npoints, Nvectors], a collection of vectors in Npoints-dimensional space
      w - matrix of shape [Npoints, Ncomponents], a collection of components
      h - matrix of shape [Ncomponents, Nvectors], a collection of the decomposition coefficients
      Returns:
      matrix H of shape [Ncomponents, Nvectors]