LocallyLinearEmbedding.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 2011 Sergey Lisitsyn
00008  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
00009  */
00010 
00011 #ifndef LOCALLYLINEAREMBEDDING_H_
00012 #define LOCALLYLINEAREMBEDDING_H_
00013 #include <shogun/lib/config.h>
00014 #ifdef HAVE_LAPACK
00015 #include <shogun/preprocessor/DimensionReductionPreprocessor.h>
00016 #include <shogun/features/Features.h>
00017 #include <shogun/distance/Distance.h>
00018 
00019 namespace shogun
00020 {
00021 
00022 class CFeatures;
00023 
00024 class CDistance;
00025 
00050 class CLocallyLinearEmbedding: public CDimensionReductionPreprocessor
00051 {
00052 public:
00053 
00055     CLocallyLinearEmbedding();
00056 
00058     virtual ~CLocallyLinearEmbedding();
00059 
00063     virtual bool init(CFeatures* features);
00064 
00067     virtual void cleanup();
00068 
00072     virtual SGMatrix<float64_t> apply_to_feature_matrix(CFeatures* features);
00073 
00077     virtual SGVector<float64_t> apply_to_feature_vector(SGVector<float64_t> vector);
00078 
00082     void inline set_k(int32_t k)
00083     {
00084         m_k = k;
00085     }
00086 
00090     int32_t inline get_k()
00091     {
00092         return m_k;
00093     }
00094 
00098     void inline set_posdef(bool posdef)
00099     {
00100         m_posdef = posdef;
00101     }
00102 
00106     bool inline get_posdef()
00107     {
00108         return m_posdef;
00109     }
00110 
00112     virtual inline const char* get_name() const { return "LocallyLinearEmbedding"; };
00113 
00115     virtual inline EPreprocessorType get_type() const { return P_LOCALLYLINEAREMBEDDING; };
00116 
00117 protected:
00118 
00120     void init();
00121 
00125     static void* run_neighborhood_thread(void* p);
00126 
00130     static void* run_linearreconstruction_thread(void* p);
00131 
00138     SGMatrix<float64_t> find_null_space(SGMatrix<float64_t> matrix, int dimension, bool force_lapack);
00139 
00145     SGMatrix<int32_t> get_neighborhood_matrix(CDistance* distance);
00146 
00147 protected:
00148 
00150     int32_t m_k;
00151 
00153     bool m_posdef;
00154 
00155 };
00156 }
00157 
00158 #endif /* HAVE_LAPACK */
00159 #endif /* LOCALLYLINEAREMBEDDING_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation