#include <NMF.h>
Public Member Functions | |
NMF (int inputSize=1024, int componentCount=3, int iterationCount=10, Real epsilon=1e-9) | |
~NMF () | |
void | process (const MatrixXR &frames, MatrixXR *gains, MatrixXR *components) |
int | inputSize () const |
void | setInputSize (int size, bool callSetup=true) |
int | componentCount () const |
void | setComponentCount (int count, bool callSetup=true) |
int | iterationCount () const |
void | setIterationCount (int count, bool callSetup=true) |
Real | epsilon () const |
void | setEpsilon (Real epsilon, bool callSetup=true) |
This class represents an object to perform a Non-negative Matrix Factorization (NMF) on a matrix of Real values. Which is a useful technique for decomposing multichannel signals into linear independent components and their respective positive gains.
The algorithm estimates a set of M temporal independent components, each of which is represented as a single row in a matrix of the same number of columns as the input matrix. The algorithm also estimates a set of M time-varying positive gains, each of which is represented as a single column in a matrix with as many rows as the input matrix.
In order to implement the NMF an iterative multiplicative update rule is applied in order to minimize the distance from the multiplication of the gains and components matrices to the input matrix.
The distance minimized in this implementation is the Kullback-Liebler divergence.
NMF | ( | int | inputSize = 1024 , |
|
int | componentCount = 3 , |
|||
int | iterationCount = 10 , |
|||
Real | epsilon = 1e-9 | |||
) |
Constructs an NMF object with the specified inputSize, componentCount, iterationCount and epsilon settings.
inputSize | size of the inputs arrays, must be > 0. | |
componentCount | number of linearly independnet components to be estimated. | |
iterationCount | number of update iterations performed to solve the NMF. | |
epsilon | parameter of the solver to clip the minimum values at each update. |
References setComponentCount(), setEpsilon(), setInputSize(), and setIterationCount().
~NMF | ( | ) |
Destroys the algorithm and frees its resources.
void process | ( | const MatrixXR & | frames, | |
MatrixXR * | gains, | |||
MatrixXR * | components | |||
) |
Performs an NMF on frames which represents multichannel signal where the rows are the time axis and the columns are the channels. Puts the resulting NMF components in the rows of components and the instantaneous gains of each components in gains.
frames | matrix of Real values. The number of columns of frames must be equal to the input size specified using setInputSize(). | |
components | pointer to a matrix of Real values for the components. The matrix should have the same number of rows as componentCount and inputSize columns. | |
gains | pointer to a matrix of Real positive values for the instantaneous gains of each component. The matrix should have the same number of rows as frames and componentCount columns. |
int inputSize | ( | ) | const |
void setInputSize | ( | int | size, | |
bool | callSetup = true | |||
) |
Specifies the size of the input. The given size must be higher than 0.
Referenced by NMF().
int componentCount | ( | ) | const |
void setComponentCount | ( | int | count, | |
bool | callSetup = true | |||
) |
Specifies the count of components to be calculated. The given count must be greater than 0.
Referenced by NMF().
int iterationCount | ( | ) | const |
void setIterationCount | ( | int | count, | |
bool | callSetup = true | |||
) |
Specifies the count of iterations of the solver. The given count must be greater than 0.
Referenced by NMF().
Real epsilon | ( | ) | const |
void setEpsilon | ( | Real | epsilon, | |
bool | callSetup = true | |||
) |