KernelPCA.h

Go to the documentation of this file.
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 Soeren Sonnenburg
00008  * Copyright (C) 2011 Berlin Institute of Technology
00009  */
00010 
00011 #ifndef KERNELPCA_H__
00012 #define KERNELPCA_H__
00013 #include <shogun/lib/config.h>
00014 #ifdef HAVE_LAPACK
00015 
00016 #include <shogun/preprocessor/DimensionReductionPreprocessor.h>
00017 #include <shogun/features/Features.h>
00018 #include <shogun/kernel/Kernel.h>
00019 #include <shogun/lib/common.h>
00020 
00021 namespace shogun
00022 {
00023 
00024 class CFeatures;
00025 class CKernel;
00026 
00035 class CKernelPCA: public CDimensionReductionPreprocessor
00036 {
00037 public:
00040         CKernelPCA();
00041 
00045         CKernelPCA(CKernel* k);
00046 
00047         virtual ~CKernelPCA();
00048 
00050         virtual bool init(CFeatures* features);
00052         virtual void cleanup();
00053 
00057         virtual SGMatrix<float64_t> apply_to_feature_matrix(CFeatures* features);
00058 
00061         virtual SGVector<float64_t> apply_to_feature_vector(SGVector<float64_t> vector);
00062 
00066         virtual CDenseFeatures<float64_t>* apply_to_string_features(CFeatures* features);
00067 
00071         SGMatrix<float64_t> get_transformation_matrix() const
00072         {
00073             return m_transformation_matrix;
00074         }
00075 
00079         SGVector<float64_t> get_bias_vector() const
00080         {
00081             return m_bias_vector;
00082         }
00083 
00085         virtual const char* get_name() const { return "KernelPCA"; }
00086 
00088         virtual EPreprocessorType get_type() const { return P_KERNELPCA; }
00089 
00090     protected:
00091 
00093         void init();
00094 
00095     protected:
00096 
00098         CFeatures* m_init_features;
00099 
00101         SGMatrix<float64_t> m_transformation_matrix;
00102 
00104         SGVector<float64_t> m_bias_vector;
00105 
00107         bool m_initialized;
00108 
00109 };
00110 }
00111 #endif
00112 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation