MLPACK  1.0.10
random_init.hpp
Go to the documentation of this file.
1 
23 #ifndef __MLPACK_METHODS_LMF_RANDOM_INIT_HPP
24 #define __MLPACK_METHODS_LMF_RANDOM_INIT_HPP
25 
26 #include <mlpack/core.hpp>
27 
28 namespace mlpack {
29 namespace amf {
30 
32 {
33  public:
34  // Empty constructor required for the InitializeRule template
36 
37  template<typename MatType>
38  inline static void Initialize(const MatType& V,
39  const size_t r,
40  arma::mat& W,
41  arma::mat& H)
42  {
43  // Simple implementation (left in the header file due to its simplicity).
44  size_t n = V.n_rows;
45  size_t m = V.n_cols;
46 
47  // Initialize to random values.
48  W.randu(n, r);
49  H.randu(r, m);
50  }
51 };
52 
53 }; // namespace amf
54 }; // namespace mlpack
55 
56 #endif
static void Initialize(const MatType &V, const size_t r, arma::mat &W, arma::mat &H)
Definition: random_init.hpp:38