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 DIMENSIONREDUCTIONPREPROCESSOR_H_ 00012 #define DIMENSIONREDUCTIONPREPROCESSOR_H_ 00013 00014 #include <shogun/preprocessor/DensePreprocessor.h> 00015 #include <shogun/converter/EmbeddingConverter.h> 00016 #include <shogun/features/Features.h> 00017 #include <shogun/distance/Distance.h> 00018 00019 namespace shogun 00020 { 00021 00022 class CFeatures; 00023 class CDistance; 00024 class CKernel; 00025 00030 class CDimensionReductionPreprocessor: public CDensePreprocessor<float64_t> 00031 { 00032 public: 00033 00035 CDimensionReductionPreprocessor(); 00036 00042 CDimensionReductionPreprocessor(CEmbeddingConverter* converter); 00043 00045 virtual ~CDimensionReductionPreprocessor(); 00046 00051 virtual bool init(CFeatures* data); 00052 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 { 00069 return vector; 00070 } 00071 00073 virtual const char* get_name() const { return "DimensionReductionPreprocessor"; }; 00074 00076 virtual EPreprocessorType get_type() const; 00077 00081 void set_target_dim(int32_t dim); 00082 00086 int32_t get_target_dim() const; 00087 00091 void set_distance(CDistance* distance); 00092 00096 CDistance* get_distance() const; 00097 00101 void set_kernel(CKernel* kernel); 00102 00106 CKernel* get_kernel() const; 00107 00108 protected: 00109 00111 void init(); 00112 00113 protected: 00114 00116 int32_t m_target_dim; 00117 00119 CDistance* m_distance; 00120 00122 CKernel* m_kernel; 00123 00125 CEmbeddingConverter* m_converter; 00126 }; 00127 } 00128 00129 #endif /* DIMENSIONREDUCTIONPREPROCESSOR_H_ */