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) 2012 Fernando José Iglesias García 00008 * Copyright (C) 2012 Fernando José Iglesias García 00009 */ 00010 00011 #ifndef STOCHASTICPROXIMITYEMBEDDING_H_ 00012 #define STOCHASTICPROXIMITYEMBEDDING_H_ 00013 #include <shogun/lib/config.h> 00014 #ifdef HAVE_LAPACK 00015 #include <shogun/converter/EmbeddingConverter.h> 00016 #include <shogun/features/Features.h> 00017 #include <shogun/distance/Distance.h> 00018 00019 namespace shogun 00020 { 00021 00023 enum ESPEStrategy 00024 { 00025 SPE_GLOBAL, 00026 SPE_LOCAL, 00027 }; 00028 00062 class CStochasticProximityEmbedding : public CEmbeddingConverter 00063 { 00064 00065 public: 00066 00068 CStochasticProximityEmbedding(); 00069 00071 virtual ~CStochasticProximityEmbedding(); 00072 00078 virtual CFeatures* apply(CFeatures* features); 00079 00084 void set_k(int32_t k); 00085 00090 int32_t get_k() const; 00091 00096 void set_strategy(ESPEStrategy strategy); 00097 00102 ESPEStrategy get_strategy() const; 00103 00108 void set_tolerance(float32_t tolerance); 00109 00114 int32_t get_tolerance() const; 00115 00120 void set_nupdates(int32_t nupdates); 00121 00126 int32_t get_nupdates() const; 00127 00129 virtual const char* get_name() const; 00130 00131 private: 00132 00134 void init(); 00135 00144 virtual SGMatrix<int32_t> get_neighborhood_matrix(CDistance* distance, int32_t k, int32_t N, float64_t max_dist); 00145 00150 virtual CDenseFeatures< float64_t >* embed_distance(CDistance* distance); 00151 00152 private: 00153 00155 ESPEStrategy m_strategy; 00156 00158 int32_t m_k; 00159 00161 float32_t m_tolerance; 00162 00164 int32_t m_nupdates; 00165 00166 }; 00167 00168 } /* namespace shogun */ 00169 00170 00171 #endif /* HAVE_LAPACK */ 00172 #endif /* STOCHASTICPROXIMITYEMBEDDING_H_ */