Package org.dulab.javanmf.algorithms
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 ofMatrixRegression
-
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 regressionorg.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 regressionorg.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 constraintorg.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
-
Constructor Details
-
MatrixRegression
Creates an instance ofMatrixRegression
- Parameters:
updateRule
- instance ofUpdateRule
for matrix Htolerance
- the fitting error tolerancemaxIteration
- 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 spacew
- matrix of shape [Npoints, Ncomponents], a collection of componentsh
- matrix of shape [Ncomponents, Nvectors], a collection of the decomposition coefficientslimit
- matrix of shape [Ncomponents, Nvectors], the upper limit for matrix Hverbose
- 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 spacew
- matrix of shape [Npoints, Ncomponents], a collection of componentsh
- matrix of shape [Ncomponents, Nvectors], a collection of the decomposition coefficientslimit
- 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 spacew
- matrix of shape [Npoints, Ncomponents], a collection of componentsh
- matrix of shape [Ncomponents, Nvectors], a collection of the decomposition coefficientsverbose
- 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 spacew
- matrix of shape [Npoints, Ncomponents], a collection of componentsh
- matrix of shape [Ncomponents, Nvectors], a collection of the decomposition coefficients- Returns:
- matrix H of shape [Ncomponents, Nvectors]
-