mlpack
|
This class implements a method titled 'Alternating Least Squares' described in the following paper: More...
#include <nmf_als.hpp>
Public Member Functions | |
NMFALSUpdate () | |
Empty constructor required for the UpdateRule template. | |
template<typename MatType > | |
void | Initialize (const MatType &, const size_t) |
Set initial values for the factorization. More... | |
template<typename Archive > | |
void | serialize (Archive &, const uint32_t) |
Serialize the object (in this case, there is nothing to serialize). | |
Static Public Member Functions | |
template<typename MatType > | |
static void | WUpdate (const MatType &V, arma::mat &W, const arma::mat &H) |
The update rule for the basis matrix W. More... | |
template<typename MatType > | |
static void | HUpdate (const MatType &V, const arma::mat &W, arma::mat &H) |
The update rule for the encoding matrix H. More... | |
This class implements a method titled 'Alternating Least Squares' described in the following paper:
It uses the least squares projection formula to reduce the error value of \( \sqrt{\sum_i \sum_j(V-WH)^2} \) by alternately calculating W and H respectively while holding the other matrix constant.
|
inlinestatic |
The update rule for the encoding matrix H.
The formula used is
\[ H = \frac{W^T V}{W^T W} \]
The function takes in all the matrices and only changes the value of the H matrix.
V | Input matrix to be factorized. |
W | Basis matrix. |
H | Encoding matrix to be updated. |
|
inline |
Set initial values for the factorization.
In this case, we don't need to set anything.
|
inlinestatic |
The update rule for the basis matrix W.
The formula used isa
\[ W^T = \frac{H V^T}{H H^T} \]
The function takes in all the matrices and only changes the value of the W matrix.
V | Input matrix to be factorized. |
W | Basis matrix to be updated. |
H | Encoding matrix. |