MLPACK
1.0.4
|
00001 00027 #ifndef __MLPACK_METHODS_NMF_MULT_DIST_UPDATE_RULES_HPP 00028 #define __MLPACK_METHODS_NMF_MULT_DIST_UPDATE_RULES_HPP 00029 00030 #include <mlpack/core.hpp> 00031 00032 namespace mlpack { 00033 namespace nmf { 00034 00041 class WMultiplicativeDistanceRule 00042 { 00043 public: 00044 // Empty constructor required for the WUpdateRule template. 00045 WMultiplicativeDistanceRule() { } 00046 00056 inline static void Update(const arma::mat& V, 00057 arma::mat& W, 00058 const arma::mat& H) 00059 { 00060 W = (W % (V * H.t())) / (W * H * H.t()); 00061 } 00062 }; 00063 00070 class HMultiplicativeDistanceRule 00071 { 00072 public: 00073 // Empty constructor required for the HUpdateRule template. 00074 HMultiplicativeDistanceRule() { } 00075 00085 inline static void Update(const arma::mat& V, 00086 const arma::mat& W, 00087 arma::mat& H) 00088 { 00089 H = (H % (W.t() * V)) / (W.t() * W * H); 00090 } 00091 }; 00092 00093 }; // namespace nmf 00094 }; // namespace mlpack 00095 00096 #endif