SHOGUN  v3.0.0
 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 #ifdef HAVE_LAPACK
18 
19 #include <shogun/base/SGObject.h>
23 #include <shogun/lib/SGMatrix.h>
24 
25 namespace shogun
26 {
27 
28 // Forward declaration
29 class CLMNNStatistics;
30 
38 class CLMNN : public CSGObject
39 {
40  public:
42  CLMNN();
43 
50  CLMNN(CDenseFeatures<float64_t>* features, CMulticlassLabels* labels, int32_t k);
51 
53  virtual ~CLMNN();
54 
56  virtual const char* get_name() const;
57 
65  void train(SGMatrix<float64_t> init_transform=SGMatrix<float64_t>());
66 
72 
80 
85  int32_t get_k() const;
86 
91  void set_k(const int32_t k);
92 
98 
103  void set_regularization(const float64_t regularization);
104 
109  float64_t get_stepsize() const;
110 
115  void set_stepsize(const float64_t stepsize);
116 
122 
127  void set_stepsize_threshold(const float64_t stepsize_threshold);
128 
133  uint32_t get_maxiter() const;
134 
139  void set_maxiter(const uint32_t maxiter);
140 
145  uint32_t get_correction() const;
146 
151  void set_correction(const uint32_t correction);
152 
158 
163  void set_obj_threshold(const float64_t obj_threshold);
164 
169  bool get_diagonal() const;
170 
175  void set_diagonal(const bool diagonal);
176 
182 
183  private:
185  void init();
186 
187  private:
189  SGMatrix<float64_t> m_linear_transform;
190 
192  CFeatures* m_features;
193 
195  CLabels* m_labels;
196 
201  float64_t m_regularization;
202 
204  int32_t m_k;
205 
210  float64_t m_stepsize;
211 
217  float64_t m_stepsize_threshold;
218 
220  uint32_t m_maxiter;
221 
226  uint32_t m_correction;
227 
234  float64_t m_obj_threshold;
235 
240  bool m_diagonal;
241 
243  CLMNNStatistics* m_statistics;
244 
245 }; /* class CLMNN */
246 
252 {
253  public:
255  CLMNNStatistics();
256 
258  virtual ~CLMNNStatistics();
259 
261  virtual const char* get_name() const;
262 
269  void resize(int32_t size);
270 
281  void set(index_t iter, float64_t obj_iter, float64_t stepsize_iter, uint32_t num_impostors_iter);
282 
283  private:
285  void init();
286 
287  public:
290 
293 
296 };
297 
298 } /* namespace shogun */
299 
300 #endif /* HAVE_LAPACK */
301 #endif /* HAVE_EIGEN3 */
302 
303 #endif /* LMNN_H_ */

SHOGUN Machine Learning Toolbox - Documentation