random_init.hpp
Go to the documentation of this file.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
00035 RandomInitialization() { }
00036
00037 template<typename MatType>
00038 inline static void Initialize(const MatType& V,
00039 const size_t r,
00040 arma::mat& W,
00041 arma::mat& H)
00042 {
00043
00044 size_t n = V.n_rows;
00045 size_t m = V.n_cols;
00046
00047
00048 W.randu(n, r);
00049 H.randu(r, m);
00050 }
00051 };
00052
00053 };
00054 };
00055
00056 #endif