12 #ifndef MLPACK_METHODS_SPARSE_CODING_DATA_DEPENDENT_RANDOM_INITIALIZER_HPP 13 #define MLPACK_METHODS_SPARSE_CODING_DATA_DEPENDENT_RANDOM_INITIALIZER_HPP 19 namespace sparse_coding {
40 arma::mat& dictionary)
43 dictionary.set_size(data.n_rows, atoms);
46 for (
size_t i = 0; i < atoms; ++i)
54 dictionary.col(i) /= norm(dictionary.col(i), 2);
Linear algebra utility functions, generally performed on matrices or vectors.
The core includes that mlpack expects; standard C++ includes and Armadillo.
static void Initialize(const arma::mat &data, const size_t atoms, arma::mat &dictionary)
Initialize the dictionary by adding together three random observations from the data, and then normalizing the atom.
A data-dependent random dictionary initializer for SparseCoding.
Miscellaneous math random-related routines.
int RandInt(const int hiExclusive)
Generates a uniform random integer.