Package org.dulab.javanmf.algorithms
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.
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 ofSingularValueDecomposition
for givenmatrix
-
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.
-
Constructor Details
-
SingularValueDecomposition
public SingularValueDecomposition(@Nonnull org.ejml.data.DMatrixRMaj x)Creates an instance ofSingularValueDecomposition
for givenmatrix
- Parameters:
x
- matrix of shape [Npoints, Nvectors] to be decomposed
-
-
Method Details
-
decompose
public void decompose(@Nonnull org.ejml.data.DMatrixRMaj w, @Nonnull org.ejml.data.DMatrixRMaj h) throws java.lang.IllegalArgumentExceptionPerforms non-negative singular value decomposition (NNDSVD) of matrix X.The parameters
w
andh
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
-