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 
00049 class CLDA : public CLinearClassifier
00050 {
00051     public:
00056         CLDA(float64_t gamma=0);
00057 
00064         CLDA(float64_t gamma, CSimpleFeatures<float64_t>* traindat, CLabels* trainlab);
00065         virtual ~CLDA();
00066 
00071         inline void set_gamma(float64_t gamma)
00072         {
00073             m_gamma=gamma;
00074         }
00075 
00080         inline float64_t get_gamma()
00081         {
00082             return m_gamma;
00083         }
00084 
00089         virtual bool train();
00090 
00095         inline virtual EClassifierType get_classifier_type()
00096         {
00097             return CT_LDA;
00098         }
00099 
00104         virtual inline void set_features(CDotFeatures* feat)
00105         {
00106             if (feat->get_feature_class() != C_SIMPLE ||
00107                 feat->get_feature_type() != F_DREAL)
00108                 SG_ERROR("LDA requires SIMPLE REAL valued features\n");
00109 
00110             CLinearClassifier::set_features(feat);
00111         }
00112 
00114         inline virtual const char* get_name() const { return "LDA"; }
00115 
00116     protected:
00118         float64_t m_gamma;
00119 };
00120 #endif
00121 #endif

SHOGUN Machine Learning Toolbox - Documentation