MLPACK
1.0.7
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
mlpack
methods
sparse_coding
sparse_coding.hpp
Go to the documentation of this file.
1
23
#ifndef __MLPACK_METHODS_SPARSE_CODING_SPARSE_CODING_HPP
24
#define __MLPACK_METHODS_SPARSE_CODING_SPARSE_CODING_HPP
25
26
#include <
mlpack/core.hpp
>
27
#include <
mlpack/methods/lars/lars.hpp
>
28
29
// Include our three simple dictionary initializers.
30
#include "
nothing_initializer.hpp
"
31
#include "
data_dependent_random_initializer.hpp
"
32
#include "
random_initializer.hpp
"
33
34
namespace
mlpack {
35
namespace
sparse_coding {
36
118
template
<
typename
DictionaryInitializer = DataDependentRandomInitializer>
119
class
SparseCoding
120
{
121
public
:
130
SparseCoding
(
const
arma::mat&
data
,
131
const
size_t
atoms
,
132
const
double
lambda1
,
133
const
double
lambda2
= 0);
134
146
void
Encode
(
const
size_t
maxIterations = 0,
147
const
double
objTolerance = 0.01,
148
const
double
newtonTolerance = 1e-6);
149
153
void
OptimizeCode
();
154
165
double
OptimizeDictionary
(
const
arma::uvec& adjacencies,
166
const
double
newtonTolerance = 1e-6);
167
171
void
ProjectDictionary
();
172
176
double
Objective
()
const
;
177
179
const
arma::mat&
Data
()
const
{
return
data
; }
180
182
const
arma::mat&
Dictionary
()
const
{
return
dictionary
; }
184
arma::mat&
Dictionary
() {
return
dictionary
; }
185
187
const
arma::mat&
Codes
()
const
{
return
codes
; }
189
arma::mat&
Codes
() {
return
codes
; }
190
191
private
:
193
size_t
atoms
;
194
196
const
arma::mat&
data
;
197
199
arma::mat
dictionary
;
200
202
arma::mat
codes
;
203
205
double
lambda1
;
206
208
double
lambda2
;
209
};
210
211
};
// namespace sparse_coding
212
};
// namespace mlpack
213
214
// Include implementation.
215
#include "sparse_coding_impl.hpp"
216
217
#endif
Generated by
1.8.3.1