mlpack 3.4.2
nmf_mult_dist.hpp
Go to the documentation of this file.
1
12#ifndef MLPACK_METHODS_LMF_UPDATE_RULES_NMF_MULT_DIST_UPDATE_RULES_HPP
13#define MLPACK_METHODS_LMF_UPDATE_RULES_NMF_MULT_DIST_UPDATE_RULES_HPP
14
15#include <mlpack/prereqs.hpp>
16
17namespace mlpack {
18namespace amf {
19
40{
41 public:
42 // Empty constructor required for the UpdateRule template.
44
49 template<typename MatType>
50 void Initialize(const MatType& /* dataset */, const size_t /* rank */)
51 {
52 // Nothing to do.
53 }
54
69 template<typename MatType>
70 inline static void WUpdate(const MatType& V,
71 arma::mat& W,
72 const arma::mat& H)
73 {
74 W = (W % (V * H.t())) / (W * H * H.t());
75 }
76
91 template<typename MatType>
92 inline static void HUpdate(const MatType& V,
93 const arma::mat& W,
94 arma::mat& H)
95 {
96 H = (H % (W.t() * V)) / (W.t() * W * H);
97 }
98
100 template<typename Archive>
101 void serialize(Archive& /* ar */, const unsigned int /* version */) { }
102};
103
104} // namespace amf
105} // namespace mlpack
106
107#endif
The multiplicative distance update rules for matrices W and H.
static void WUpdate(const MatType &V, arma::mat &W, const arma::mat &H)
The update rule for the basis matrix W.
void serialize(Archive &, const unsigned int)
Serialize the object (in this case, there is nothing to serialize).
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.
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
The core includes that mlpack expects; standard C++ includes and Armadillo.