KernelRidgeRegression.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) 2006 Mikio L. Braun
00008  * Written (W) 1999-2009 Soeren Sonnenburg
00009  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
00010  */
00011 
00012 #ifndef _KERNELRIDGEREGRESSION_H__
00013 #define _KERNELRIDGEREGRESSION_H__
00014 
00015 #include <shogun/lib/config.h>
00016 #include <shogun/regression/Regression.h>
00017 
00018 #ifdef HAVE_LAPACK
00019 
00020 #include <shogun/machine/KernelMachine.h>
00021 
00022 namespace shogun
00023 {
00024 
00026 enum ETrainingType
00027 {
00029     PINV=1,
00031     GS=2
00032 };
00033 
00064 class CKernelRidgeRegression : public CKernelMachine
00065 {
00066     public:
00068         MACHINE_PROBLEM_TYPE(PT_REGRESSION);
00069 
00071         CKernelRidgeRegression();
00072 
00080         CKernelRidgeRegression(float64_t tau, CKernel* k, CLabels* lab, ETrainingType m=PINV);
00081 
00083         virtual ~CKernelRidgeRegression() {}
00084 
00089         inline void set_tau(float64_t tau) { m_tau = tau; };
00090 
00095         inline void set_epsilon(float64_t epsilon) { m_epsilon = epsilon; }
00096 
00102         virtual bool load(FILE* srcfile);
00103 
00109         virtual bool save(FILE* dstfile);
00110 
00115         virtual EMachineType get_classifier_type()
00116         {
00117             return CT_KERNELRIDGEREGRESSION;
00118         }
00119 
00121         virtual const char* get_name() const { return "KernelRidgeRegression"; }
00122 
00123     protected:
00132         virtual bool train_machine(CFeatures* data=NULL);
00133 
00134     private:
00135         void init();
00136 
00141         bool train_machine_gs();
00142 
00147         bool train_machine_pinv();
00148 
00149     private:
00151         float64_t m_tau;
00152 
00154         float64_t m_epsilon;
00155 
00157         ETrainingType m_train_func;
00158 };
00159 }
00160 
00161 #endif // HAVE_LAPACK
00162 #endif // _KERNELRIDGEREGRESSION_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation