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 ISOMAP_H_ 00012 #define ISOMAP_H_ 00013 #include <shogun/lib/config.h> 00014 #ifdef HAVE_LAPACK 00015 #include <shogun/preprocessor/MultidimensionalScaling.h> 00016 #include <shogun/lib/common.h> 00017 #include <shogun/mathematics/Math.h> 00018 #include <shogun/io/SGIO.h> 00019 #include <shogun/features/Features.h> 00020 #include <shogun/distance/Distance.h> 00021 #include <shogun/distance/CustomDistance.h> 00022 #include <shogun/distance/EuclidianDistance.h> 00023 00024 namespace shogun 00025 { 00026 00027 class CFeatures; 00028 00029 class CDistance; 00030 00047 class CIsomap: public CMultidimensionalScaling 00048 { 00049 public: 00050 00051 /* constructor */ 00052 CIsomap(); 00053 00054 /* destructor */ 00055 virtual ~CIsomap(); 00056 00060 virtual bool init(CFeatures* features); 00061 00064 virtual void cleanup(); 00065 00070 virtual CSimpleFeatures<float64_t>* apply_to_distance(CDistance* distance); 00071 00076 virtual SGMatrix<float64_t> apply_to_feature_matrix(CFeatures* features); 00077 00081 virtual SGVector<float64_t> apply_to_feature_vector(SGVector<float64_t> vector); 00082 00084 virtual inline const char* get_name() const { return "Isomap"; }; 00085 00087 virtual inline EPreprocessorType get_type() const { return P_ISOMAP; }; 00088 00092 void inline set_k(int32_t k) 00093 { 00094 ASSERT(k>=1); 00095 m_k = k; 00096 } 00097 00101 int32_t inline get_k() 00102 { 00103 return m_k; 00104 } 00105 00106 00107 protected: 00108 00110 int32_t m_k; 00111 00112 protected: 00113 00115 void init(); 00116 00120 static void* run_dijkstra_thread(void* p); 00121 00126 SGMatrix<float64_t> isomap_distance(SGMatrix<float64_t> D_matrix); 00127 00128 }; 00129 } 00130 #endif /* HAVE_LAPACK */ 00131 00132 #endif /* ISOMAP_H_ */