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 
17 namespace mlpack {
18 namespace 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 uint32_t /* version */) { }
102 };
103 
104 } // namespace amf
105 } // namespace mlpack
106 
107 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
static void HUpdate(const MatType &V, const arma::mat &W, arma::mat &H)
The update rule for the encoding matrix H.
The core includes that mlpack expects; standard C++ includes, Armadillo, cereal, and a few basic mlpa...
void Initialize(const MatType &, const size_t)
Initialize the factorization.
static void WUpdate(const MatType &V, arma::mat &W, const arma::mat &H)
The update rule for the basis matrix W.
The multiplicative distance update rules for matrices W and H.
void serialize(Archive &, const uint32_t)
Serialize the object (in this case, there is nothing to serialize).