SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LMNN.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2013 Fernando J. Iglesias Garcia
8  * Copyright (C) 2013 Fernando J. Iglesias Garcia
9  */
10 
11 #ifndef LMNN_H_
12 #define LMNN_H_
13 
14 #include <shogun/lib/config.h>
15 
16 #ifdef HAVE_EIGEN3
17 
18 #include <shogun/base/SGObject.h>
22 #include <shogun/lib/SGMatrix.h>
23 
24 namespace shogun
25 {
26 
27 // Forward declaration
28 class CLMNNStatistics;
29 
37 class CLMNN : public CSGObject
38 {
39  public:
41  CLMNN();
42 
49  CLMNN(CDenseFeatures<float64_t>* features, CMulticlassLabels* labels, int32_t k);
50 
52  virtual ~CLMNN();
53 
55  virtual const char* get_name() const;
56 
64  void train(SGMatrix<float64_t> init_transform=SGMatrix<float64_t>());
65 
71 
79 
84  int32_t get_k() const;
85 
90  void set_k(const int32_t k);
91 
97 
102  void set_regularization(const float64_t regularization);
103 
108  float64_t get_stepsize() const;
109 
114  void set_stepsize(const float64_t stepsize);
115 
121 
126  void set_stepsize_threshold(const float64_t stepsize_threshold);
127 
132  uint32_t get_maxiter() const;
133 
138  void set_maxiter(const uint32_t maxiter);
139 
144  uint32_t get_correction() const;
145 
150  void set_correction(const uint32_t correction);
151 
157 
162  void set_obj_threshold(const float64_t obj_threshold);
163 
168  bool get_diagonal() const;
169 
174  void set_diagonal(const bool diagonal);
175 
181 
182  private:
184  void init();
185 
186  private:
188  SGMatrix<float64_t> m_linear_transform;
189 
191  CFeatures* m_features;
192 
194  CLabels* m_labels;
195 
200  float64_t m_regularization;
201 
203  int32_t m_k;
204 
209  float64_t m_stepsize;
210 
216  float64_t m_stepsize_threshold;
217 
219  uint32_t m_maxiter;
220 
225  uint32_t m_correction;
226 
233  float64_t m_obj_threshold;
234 
239  bool m_diagonal;
240 
242  CLMNNStatistics* m_statistics;
243 
244 }; /* class CLMNN */
245 
251 {
252  public:
254  CLMNNStatistics();
255 
257  virtual ~CLMNNStatistics();
258 
260  virtual const char* get_name() const;
261 
268  void resize(int32_t size);
269 
280  void set(index_t iter, float64_t obj_iter, float64_t stepsize_iter, uint32_t num_impostors_iter);
281 
282  private:
284  void init();
285 
286  public:
289 
292 
295 };
296 
297 } /* namespace shogun */
298 
299 #endif /* HAVE_EIGEN3 */
300 
301 #endif /* LMNN_H_ */

SHOGUN Machine Learning Toolbox - Documentation