SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LocallyLinearEmbedding.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) 2011 Sergey Lisitsyn
8  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9  */
10 
11 #ifndef LOCALLYLINEAREMBEDDING_H_
12 #define LOCALLYLINEAREMBEDDING_H_
13 #include <shogun/lib/config.h>
14 #ifdef HAVE_LAPACK
19 
20 namespace shogun
21 {
22 
23 class CFeatures;
24 class CDistance;
25 
68 {
69 public:
70 
73 
75  virtual ~CLocallyLinearEmbedding();
76 
80  virtual CFeatures* apply(CFeatures* features);
81 
85  void set_k(int32_t k);
86 
90  int32_t get_k() const;
91 
95  void set_max_k(int32_t max_k);
96 
100  int32_t get_max_k() const;
101 
105  void set_auto_k(bool auto_k);
106 
110  bool get_auto_k() const;
111 
115  void set_reconstruction_shift(float64_t reconstruction_shift);
116 
121 
125  void set_nullspace_shift(float64_t nullspace_shift);
126 
131 
135  void set_use_arpack(bool use_arpack);
136 
140  bool get_use_arpack() const;
141 
143  virtual const char* get_name() const;
144 
146 protected:
147 
149  void init();
150 
157  SGMatrix<int32_t> neighborhood_matrix);
158 
164  virtual SGMatrix<float64_t> construct_embedding(SGMatrix<float64_t> matrix,int dimension);
165 
171  virtual SGMatrix<int32_t> get_neighborhood_matrix(SGMatrix<float64_t> distance_matrix, int32_t k);
172 
178  int32_t estimate_k(CDenseFeatures<float64_t>* simple_features, SGMatrix<int32_t> neighborhood_matrix);
179 
192  float64_t compute_reconstruction_error(int32_t k, int dim, int N, float64_t* feature_matrix,
193  float64_t* z_matrix, float64_t* covariance_matrix,
194  float64_t* resid_vector, float64_t* id_vector,
195  SGMatrix<int32_t> neighborhood_matrix);
196 
198 protected:
199 
201  int32_t m_k;
202 
204  int32_t m_max_k;
205 
208 
211 
214 
216  bool m_auto_k;
217 
219 protected:
220 
224  static void* run_linearreconstruction_thread(void* p);
225 
226 };
227 }
228 
229 #endif /* HAVE_LAPACK */
230 #endif /* LOCALLYLINEAREMBEDDING_H_ */

SHOGUN Machine Learning Toolbox - Documentation