23 #ifndef __MLPACK_METHODS_SPARSE_CODING_RANDOM_INITIALIZER_HPP
24 #define __MLPACK_METHODS_SPARSE_CODING_RANDOM_INITIALIZER_HPP
29 namespace sparse_coding {
49 arma::mat& dictionary)
52 dictionary.randn(data.n_rows, atoms);
55 for (
size_t j = 0; j < atoms; ++j)
56 dictionary.col(j) /= norm(dictionary.col(j), 2);
A DictionaryInitializer for use with the SparseCoding class.
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...