12 #ifndef MLPACK_METHODS_LMF_UPDATE_RULES_NMF_MULT_DIV_HPP 13 #define MLPACK_METHODS_LMF_UPDATE_RULES_NMF_MULT_DIV_HPP 58 template<
typename MatType>
79 template<
typename MatType>
80 inline static void WUpdate(
const MatType& V,
89 for (
size_t i = 0; i < W.n_rows; ++i)
91 for (
size_t j = 0; j < W.n_cols; ++j)
97 t2.set_size(H.n_cols);
98 for (
size_t k = 0; k < t2.n_elem; ++k)
100 t2(k) = H(j, k) * V(i, k) / t1(i, k);
103 W(i, j) = W(i, j) * sum(t2) / sum(H.row(j));
123 template<
typename MatType>
133 for (
size_t i = 0; i < H.n_rows; ++i)
135 for (
size_t j = 0; j < H.n_cols; ++j)
141 t2.set_size(W.n_rows);
142 for (
size_t k = 0; k < t2.n_elem; ++k)
144 t2(k) = W(k, i) * V(k, j) / t1(k, j);
147 H(i, j) = H(i, j) * sum(t2) / sum(W.col(i));
153 template<
typename Archive>
void serialize(Archive &, const uint32_t)
Serialize the object (in this case, there is nothing to serialize).
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
NMFMultiplicativeDivergenceUpdate()
void Initialize(const MatType &, const size_t)
Initialize the factorization.
This follows a method described in the paper 'Algorithms for Non-negative.
static void WUpdate(const MatType &V, arma::mat &W, const arma::mat &H)
The update rule for the basis matrix W.
static void HUpdate(const MatType &V, const arma::mat &W, arma::mat &H)
The update rule for the encoding matrix H.