MLPACK  1.0.8
lcc.hpp
Go to the documentation of this file.
1 
23 #ifndef __MLPACK_METHODS_LOCAL_COORDINATE_CODING_LCC_HPP
24 #define __MLPACK_METHODS_LOCAL_COORDINATE_CODING_LCC_HPP
25 
26 #include <mlpack/core.hpp>
28 
29 // Include three simple dictionary initializers from sparse coding.
30 #include "../sparse_coding/nothing_initializer.hpp"
31 #include "../sparse_coding/data_dependent_random_initializer.hpp"
32 #include "../sparse_coding/random_initializer.hpp"
33 
34 namespace mlpack {
35 namespace lcc {
36 
89 template<typename DictionaryInitializer =
92 {
93  public:
101  LocalCoordinateCoding(const arma::mat& data,
102  const size_t atoms,
103  const double lambda);
104 
113  void Encode(const size_t maxIterations = 0,
114  const double objTolerance = 0.01);
115 
119  void OptimizeCode();
120 
128  void OptimizeDictionary(arma::uvec adjacencies);
129 
133  double Objective(arma::uvec adjacencies) const;
134 
136  const arma::mat& Data() const { return data; }
137 
139  const arma::mat& Dictionary() const { return dictionary; }
141  arma::mat& Dictionary() { return dictionary; }
142 
144  const arma::mat& Codes() const { return codes; }
146  arma::mat& Codes() { return codes; }
147 
148  private:
150  size_t atoms;
151 
153  const arma::mat& data;
154 
156  arma::mat dictionary;
157 
159  arma::mat codes;
160 
162  double lambda;
163 };
164 
165 }; // namespace lcc
166 }; // namespace mlpack
167 
168 // Include implementation.
169 #include "lcc_impl.hpp"
170 
171 #endif