mlpack  2.0.1
nmf_mult_dist.hpp
Go to the documentation of this file.
1 
14 #ifndef __MLPACK_METHODS_LMF_UPDATE_RULES_NMF_MULT_DIST_UPDATE_RULES_HPP
15 #define __MLPACK_METHODS_LMF_UPDATE_RULES_NMF_MULT_DIST_UPDATE_RULES_HPP
16 
17 #include <mlpack/core.hpp>
18 
19 namespace mlpack {
20 namespace amf {
21 
42 {
43  public:
44  // Empty constructor required for the UpdateRule template.
46 
51  template<typename MatType>
52  void Initialize(const MatType& /* dataset */, const size_t /* rank */)
53  {
54  // Nothing to do.
55  }
56 
71  template<typename MatType>
72  inline static void WUpdate(const MatType& V,
73  arma::mat& W,
74  const arma::mat& H)
75  {
76  W = (W % (V * H.t())) / (W * H * H.t());
77  }
78 
93  template<typename MatType>
94  inline static void HUpdate(const MatType& V,
95  const arma::mat& W,
96  arma::mat& H)
97  {
98  H = (H % (W.t() * V)) / (W.t() * W * H);
99  }
100 
102  template<typename Archive>
103  void Serialize(Archive& /* ar */, const unsigned int /* version */) { }
104 };
105 
106 } // namespace amf
107 } // namespace mlpack
108 
109 #endif
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.
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.
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
The multiplicative distance update rules for matrices W and H.