MLPACK  1.0.11
nmf_mult_dist.hpp
Go to the documentation of this file.
1 
22 #ifndef __MLPACK_METHODS_LMF_UPDATE_RULES_NMF_MULT_DIST_UPDATE_RULES_HPP
23 #define __MLPACK_METHODS_LMF_UPDATE_RULES_NMF_MULT_DIST_UPDATE_RULES_HPP
24 
25 #include <mlpack/core.hpp>
26 
27 namespace mlpack {
28 namespace amf {
29 
39 {
40  public:
41  // Empty constructor required for the UpdateRule template.
43 
44  template<typename MatType>
45  void Initialize(const MatType& dataset, const size_t rank)
46  {
47  (void)dataset;
48  (void)rank;
49  }
50 
63  template<typename MatType>
64  inline static void WUpdate(const MatType& V,
65  arma::mat& W,
66  const arma::mat& H)
67  {
68  W = (W % (V * H.t())) / (W * H * H.t());
69  }
70 
83  template<typename MatType>
84  inline static void HUpdate(const MatType& V,
85  const arma::mat& W,
86  arma::mat& H)
87  {
88  H = (H % (W.t() * V)) / (W.t() * W * H);
89  }
90 };
91 
92 }; // namespace amf
93 }; // namespace mlpack
94 
95 #endif