14 #ifndef __MLPACK_METHODS_LMF_RANDOM_ACOL_INIT_HPP 15 #define __MLPACK_METHODS_LMF_RANDOM_ACOL_INIT_HPP 44 template<
size_t columnsToAverage = 5>
52 template<
typename MatType>
58 const size_t n = V.n_rows;
59 const size_t m = V.n_cols;
61 if (columnsToAverage > m)
63 Log::Warn <<
"Number of random columns (columnsToAverage) is more than " 64 <<
"the number of columns available in the V matrix; weird results " 65 <<
"may ensue!" << std::endl;
71 for (
size_t col = 0; col < r; col++)
73 for (
size_t randCol = 0; randCol < columnsToAverage; randCol++)
81 W /= columnsToAverage;
88 template<
typename Archive>
Linear algebra utility functions, generally performed on matrices or vectors.
static void Initialize(const MatType &V, const size_t r, arma::mat &W, arma::mat &H)
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
void Serialize(Archive &, const unsigned int)
Serialize the object (in this case, there is nothing to serialize).
static util::PrefixedOutStream Warn
Prints warning messages prefixed with [WARN ].
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.
RandomAcolInitialization()