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 KERNELLOCALLYLINEAREMBEDDING_H_ 00012 #define KERNELLOCALLYLINEAREMBEDDING_H_ 00013 #include <shogun/lib/config.h> 00014 #ifdef HAVE_LAPACK 00015 #include <shogun/preprocessor/LocallyLinearEmbedding.h> 00016 #include <shogun/features/Features.h> 00017 #include <shogun/distance/Distance.h> 00018 #include <shogun/kernel/Kernel.h> 00019 00020 namespace shogun 00021 { 00022 00023 class CFeatures; 00024 00025 class CKernel; 00026 00035 class CKernelLocallyLinearEmbedding: public CLocallyLinearEmbedding 00036 { 00037 public: 00038 00040 CKernelLocallyLinearEmbedding(); 00041 00045 CKernelLocallyLinearEmbedding(CKernel* kernel); 00046 00048 virtual ~CKernelLocallyLinearEmbedding(); 00049 00053 virtual bool init(CFeatures* features); 00054 00057 virtual void cleanup(); 00058 00062 virtual SGMatrix<float64_t> apply_to_feature_matrix(CFeatures* features); 00063 00067 virtual SGVector<float64_t> apply_to_feature_vector(SGVector<float64_t> vector); 00068 00072 void inline set_kernel(CKernel* kernel) 00073 { 00074 SG_UNREF(m_kernel); 00075 SG_REF(kernel); 00076 m_kernel = kernel; 00077 }; 00078 00082 CKernel* get_kernel() const 00083 { 00084 SG_REF(m_kernel); 00085 return m_kernel; 00086 }; 00087 00089 virtual inline const char* get_name() const { return "KernelLocallyLinearEmbedding"; }; 00090 00092 virtual inline EPreprocessorType get_type() const { return P_KERNELLOCALLYLINEAREMBEDDING; }; 00093 00094 protected: 00095 00097 void init(); 00098 00102 static void* run_neighborhood_thread(void* p); 00103 00107 static void* run_linearreconstruction_thread(void* p); 00108 00114 SGMatrix<int32_t> get_neighborhood_matrix(SGMatrix<float64_t> kernel_matrix); 00115 00116 protected: 00117 00119 CKernel* m_kernel; 00120 00121 }; 00122 } 00123 00124 #endif /* HAVE_LAPACK */ 00125 #endif /* KERNELLOCALLYLINEAREMBEDDING_H_ */