SHOGUN
v3.2.0
|
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) 1999-2008 Gunnar Raetsch 00008 * Written (W) 1999-2008 Soeren Sonnenburg 00009 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00010 */ 00011 00012 #ifndef _CPRUNE_VAR_SUB_MEAN__H__ 00013 #define _CPRUNE_VAR_SUB_MEAN__H__ 00014 00015 #include <shogun/preprocessor/DensePreprocessor.h> 00016 #include <shogun/features/Features.h> 00017 #include <shogun/lib/common.h> 00018 00019 #include <stdio.h> 00020 00021 namespace shogun 00022 { 00029 class CPruneVarSubMean : public CDensePreprocessor<float64_t> 00030 { 00031 public: 00036 CPruneVarSubMean(bool divide=true); 00037 00039 virtual ~CPruneVarSubMean(); 00040 00042 virtual bool init(CFeatures* features); 00043 00045 virtual void cleanup(); 00046 00050 virtual SGMatrix<float64_t> apply_to_feature_matrix(CFeatures* features); 00051 00054 virtual SGVector<float64_t> apply_to_feature_vector(SGVector<float64_t> vector); 00055 00057 virtual const char* get_name() const { return "PruneVarSubMean"; } 00058 00060 virtual EPreprocessorType get_type() const { return P_PRUNEVARSUBMEAN; } 00061 00062 private: 00063 void init(); 00064 void register_parameters(); 00065 00066 protected: 00068 SGVector<int32_t> m_idx; 00070 SGVector<float64_t> m_mean; 00072 SGVector<float64_t> m_std; 00074 int32_t m_num_idx; 00076 bool m_divide_by_std; 00077 00079 bool m_initialized; 00080 }; 00081 } 00082 #endif