13 #ifndef MLPACK_METHODS_SPARSE_CODING_RANDOM_INITIALIZER_HPP 14 #define MLPACK_METHODS_SPARSE_CODING_RANDOM_INITIALIZER_HPP 19 namespace sparse_coding {
39 arma::mat& dictionary)
42 dictionary.randn(data.n_rows, atoms);
45 for (
size_t j = 0; j < atoms; ++j)
46 dictionary.col(j) /= norm(dictionary.col(j), 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 randomly from a normal distribution, such that each atom has a norm of 1...
A DictionaryInitializer for use with the SparseCoding class.