14 #ifndef __MLPACK_METHODS_LMF_UPDATE_RULES_NMF_MULT_DIV_HPP
15 #define __MLPACK_METHODS_LMF_UPDATE_RULES_NMF_MULT_DIV_HPP
60 template<
typename MatType>
81 template<
typename MatType>
82 inline static void WUpdate(
const MatType& V,
91 for (
size_t i = 0; i < W.n_rows; ++i)
93 for (
size_t j = 0; j < W.n_cols; ++j)
99 t2.set_size(H.n_cols);
100 for (
size_t k = 0; k < t2.n_elem; ++k)
102 t2(k) = H(j, k) * V(i, k) / t1(i, k);
105 W(i, j) = W(i, j) * sum(t2) / sum(H.row(j));
125 template<
typename MatType>
135 for (
size_t i = 0; i < H.n_rows; i++)
137 for (
size_t j = 0; j < H.n_cols; j++)
143 t2.set_size(W.n_rows);
144 for (
size_t k = 0; k < t2.n_elem; ++k)
146 t2(k) = W(k, i) * V(k, j) / t1(k, j);
149 H(i,j) = H(i,j) * sum(t2) / sum(W.col(i));
155 template<
typename Archive>
static void WUpdate(const MatType &V, arma::mat &W, const arma::mat &H)
The update rule for the basis matrix W.
Linear algebra utility functions, generally performed on matrices or vectors.
void Serialize(Archive &, const unsigned int)
Serialize the object (in this case, there is nothing to serialize).
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
NMFMultiplicativeDivergenceUpdate()
void Initialize(const MatType &, const size_t)
Initialize the factorization.
static void HUpdate(const MatType &V, const arma::mat &W, arma::mat &H)
The update rule for the encoding matrix H.
This follows a method described in the paper 'Algorithms for Non-negative.