public class NonNegativeMatrixFactorizationMultiplicative extends Object implements MatrixFactorization
Matrix
as A
, then
A can be approximated by
WH
W
and H
are initialized with random uniform values from 0 to
1. They are both updated iteratively using the following rules:
W <- W .* (AHt) ./ (W(HHt))
H <- H .* (WtA) ./ ((WtW)H)
Where t
stands for the transpose.
These updates are made by fixing one of the matrices and updating the other
for a small number of iterations and then updating the other while keeping
the first fixed. This alternating update is done for a large number of
iterations.Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_INNER_ITERATIONS
By default, use this many inner iterations.
|
static String |
DEFAULT_OUTER_ITERATIONS
By default, use this many outer iterations.
|
static String |
INNER_ITERATIONS
The System Property used to define the number inner multiplicative
iterations to use when decomposing a matrix.
|
static String |
OUTER_ITERATIONS
The System Property used to define the number outer multiplicative
iterations to use when decomposing a matrix.
|
static String |
PROPERTY_PREFIX
The base property prefix.
|
Constructor and Description |
---|
NonNegativeMatrixFactorizationMultiplicative()
Creates a new
NonNegativeMatrixFactorizationMultiplicative using
the system defined Properties |
NonNegativeMatrixFactorizationMultiplicative(int innerLoop,
int outerLoop)
Creates a new
NonNegativeMatrixFactorizationMultiplicative . |
NonNegativeMatrixFactorizationMultiplicative(Properties props)
Creates a new
NonNegativeMatrixFactorizationMultiplicative using
the provided Properties |
Modifier and Type | Method and Description |
---|---|
Matrix |
classFeatures()
Returns the latent class by feature
Matrix . |
Matrix |
dataClasses()
Returns the data point by latent class
Matrix . |
void |
factorize(MatrixFile mFile,
int numDimensions)
Factorizes the
MatrixFile m . |
void |
factorize(SparseMatrix matrix,
int numDimensions)
Factorizes the
SparseMatrix m . |
MatrixBuilder |
getBuilder()
Returns a
MatrixBuilder that is optimized for MatrixFile s
that will be processed by this MatrixFactorization algorithm. |
static void |
initialize(Matrix m)
Initializes every value in
m to be a random value between 0 and
1, inclusive. |
public static final String PROPERTY_PREFIX
public static final String OUTER_ITERATIONS
public static final String INNER_ITERATIONS
public static final String DEFAULT_OUTER_ITERATIONS
public static final String DEFAULT_INNER_ITERATIONS
public NonNegativeMatrixFactorizationMultiplicative()
NonNegativeMatrixFactorizationMultiplicative
using
the system defined Properties
public NonNegativeMatrixFactorizationMultiplicative(Properties props)
NonNegativeMatrixFactorizationMultiplicative
using
the provided Properties
public NonNegativeMatrixFactorizationMultiplicative(int innerLoop, int outerLoop)
NonNegativeMatrixFactorizationMultiplicative
.innerLoop
- The number of iterations for updating a single matrix
while keeping the matrix fixedouterloop
- The number of innerLoop
iterations to performpublic void factorize(MatrixFile mFile, int numDimensions)
MatrixFile
m
. If m
is of size
MxN, this will generate two matrices: one of size MxnumDimensions
and one of size numDimensions
xN. This method must be called
before calling dataClasses
and classFeatures
.factorize
in interface MatrixFactorization
public void factorize(SparseMatrix matrix, int numDimensions)
SparseMatrix
m
. If m
is of size
MxN, this will generate two matrices: one of size MxnumDimensions
and one of size numDimensions
xN. This method must be called
before calling dataClasses
and classFeatures
.factorize
in interface MatrixFactorization
public Matrix dataClasses()
Matrix
. This matrix
represents the degree by which each data point can be explained by the
discovered latent classes. Actual interpretations of the latent classes
depends on the actual algorithm used. This Matrix
can be used as
a reduced representation of the data points themselves.dataClasses
in interface MatrixFactorization
public Matrix classFeatures()
Matrix
. This matrix
represents the degree by which each feature affects each latent class.
Actual interpretations of this interaction depends on the actual
algorithm used. This Matrix
can be used as a reduced
representation of the features.classFeatures
in interface MatrixFactorization
public MatrixBuilder getBuilder()
MatrixBuilder
that is optimized for MatrixFile
s
that will be processed by this MatrixFactorization
algorithm.getBuilder
in interface MatrixFactorization
public static void initialize(Matrix m)
m
to be a random value between 0 and
1, inclusive.Copyright © 2012. All Rights Reserved.