23 #ifndef __MLPACK_METHODS_SPARSE_CODING_SPARSE_CODING_HPP
24 #define __MLPACK_METHODS_SPARSE_CODING_SPARSE_CODING_HPP
35 namespace sparse_coding {
118 template<
typename DictionaryInitializer = DataDependentRandomInitializer>
146 void Encode(
const size_t maxIterations = 0,
147 const double objTolerance = 0.01,
148 const double newtonTolerance = 1e-6);
168 const double newtonTolerance = 1e-6,
169 const size_t maxIterations = 50);
221 #include "sparse_coding_impl.hpp"
arma::mat & Codes()
Modify the sparse codes.
void ProjectDictionary()
Project each atom of the dictionary back onto the unit ball, if necessary.
Linear algebra utility functions, generally performed on matrices or vectors.
const arma::mat & data
Data matrix (columns are points).
arma::mat & Dictionary()
Modify the dictionary.
const arma::mat & Dictionary() const
Access the dictionary.
void Encode(const size_t maxIterations=0, const double objTolerance=0.01, const double newtonTolerance=1e-6)
Run Sparse Coding with Dictionary Learning.
arma::mat dictionary
Dictionary (columns are atoms).
double lambda1
l1 regularization term.
std::string ToString() const
An implementation of Sparse Coding with Dictionary Learning that achieves sparsity via an l1-norm reg...
const arma::mat & Data() const
Access the data.
void OptimizeCode()
Sparse code each point via LARS.
SparseCoding(const arma::mat &data, const size_t atoms, const double lambda1, const double lambda2=0)
Set the parameters to SparseCoding.
const arma::mat & Codes() const
Access the sparse codes.
double Objective() const
Compute the objective function.
double OptimizeDictionary(const arma::uvec &adjacencies, const double newtonTolerance=1e-6, const size_t maxIterations=50)
Learn dictionary via Newton method based on Lagrange dual.
double lambda2
l2 regularization term.
arma::mat codes
Sparse codes (columns are points).
size_t atoms
Number of atoms.