MLPACK
1.0.4
|
00001 00023 #ifndef __MLPACK_METHODS_NMF_RANDOM_INIT_HPP 00024 #define __MLPACK_METHODS_NMF_RANDOM_INIT_HPP 00025 00026 #include <mlpack/core.hpp> 00027 00028 namespace mlpack { 00029 namespace nmf { 00030 00031 class RandomInitialization 00032 { 00033 public: 00034 // Empty constructor required for the InitializeRule template 00035 RandomInitialization() { } 00036 00037 inline static void Initialize(const arma::mat& V, 00038 const size_t r, 00039 arma::mat& W, 00040 arma::mat& H) 00041 { 00042 // Simple implementation (left in the header file due to its simplicity). 00043 size_t n = V.n_rows; 00044 size_t m = V.n_cols; 00045 00046 // Intialize to random values. 00047 W.randu(n, r); 00048 H.randu(r, m); 00049 } 00050 }; 00051 00052 }; // namespace nmf 00053 }; // namespace mlpack 00054 00055 #endif