LDA.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) 1999-2009 Soeren Sonnenburg
00008  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
00009  */
00010 
00011 #ifndef _LDA_H___
00012 #define _LDA_H___
00013 
00014 #include "lib/config.h"
00015 
00016 #ifdef HAVE_LAPACK
00017 #include "lib/common.h"
00018 #include "features/Features.h"
00019 #include "features/SimpleFeatures.h"
00020 #include "classifier/LinearClassifier.h"
00021 
00022 namespace shogun
00023 {
00024     template <class ST> class CSimpleFeatures;
00052 #define IGNORE_IN_CLASSLIST
00053 IGNORE_IN_CLASSLIST class CLDA : public CLinearClassifier
00054 {
00055     public:
00060         CLDA(float64_t gamma=0);
00061 
00068         CLDA(float64_t gamma, CSimpleFeatures<float64_t>* traindat, CLabels* trainlab);
00069         virtual ~CLDA();
00070 
00075         inline void set_gamma(float64_t gamma)
00076         {
00077             m_gamma=gamma;
00078         }
00079 
00084         inline float64_t get_gamma()
00085         {
00086             return m_gamma;
00087         }
00088 
00097         virtual bool train(CFeatures* data=NULL);
00098 
00103         inline virtual EClassifierType get_classifier_type()
00104         {
00105             return CT_LDA;
00106         }
00107 
00112         virtual inline void set_features(CDotFeatures* feat)
00113         {
00114             if (feat->get_feature_class() != C_SIMPLE ||
00115                 feat->get_feature_type() != F_DREAL)
00116                 SG_ERROR("LDA requires SIMPLE REAL valued features\n");
00117 
00118             CLinearClassifier::set_features(feat);
00119         }
00120 
00122         inline virtual const char* get_name() const { return "LDA"; }
00123 
00124     protected:
00126         float64_t m_gamma;
00127 };
00128 }
00129 #endif
00130 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation