12 #ifndef MLPACK_METHODS_LMF_RANDOM_ACOL_INIT_HPP 13 #define MLPACK_METHODS_LMF_RANDOM_ACOL_INIT_HPP 43 template<
size_t columnsToAverage = 5>
51 template<
typename MatType>
57 const size_t n = V.n_rows;
58 const size_t m = V.n_cols;
60 if (columnsToAverage > m)
62 Log::Warn <<
"Number of random columns (columnsToAverage) is more than " 63 <<
"the number of columns available in the V matrix; weird results " 64 <<
"may ensue!" << std::endl;
70 for (
size_t col = 0; col < r; col++)
72 for (
size_t randCol = 0; randCol < columnsToAverage; randCol++)
80 W /= columnsToAverage;
87 template<
typename Archive>
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
RandomAcolInitialization()
Miscellaneous math random-related routines.
This class initializes the W matrix of the AMF algorithm by averaging p randomly chosen columns of V...
int RandInt(const int hiExclusive)
Generates a uniform random integer.
static MLPACK_EXPORT util::PrefixedOutStream Warn
Prints warning messages prefixed with [WARN ].
void serialize(Archive &, const uint32_t)
Serialize the object (in this case, there is nothing to serialize).
static void Initialize(const MatType &V, const size_t r, arma::mat &W, arma::mat &H)