SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LDA.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 1999-2009 Soeren Sonnenburg
8  * Written (W) 2014 Abhijeet Kislay
9  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
10  */
11 
12 #ifndef _LDA_H___
13 #define _LDA_H___
14 
15 #include <shogun/lib/config.h>
16 
17 #ifdef HAVE_EIGEN3
18 #include <shogun/lib/common.h>
22 
23 namespace shogun
24 {
25 
28 {
32  AUTO_LDA = 10,
35  SVD_LDA = 20,
38  FLD_LDA = 30
39 };
40 
41 template <class ST> class CDenseFeatures;
90 class CLDA : public CLinearMachine
91 {
92  public:
94 
100  CLDA(float64_t gamma=0, ELDAMethod method=AUTO_LDA);
101 
110  CLDA(float64_t gamma, CDenseFeatures<float64_t>* traindat, CLabels* trainlab, ELDAMethod method=AUTO_LDA);
111  virtual ~CLDA();
112 
117  inline void set_gamma(float64_t gamma)
118  {
119  m_gamma=gamma;
120  }
121 
127  {
128  return m_gamma;
129  }
130 
136  {
137  return CT_LDA;
138  }
139 
144  virtual void set_features(CDotFeatures* feat)
145  {
146  if (feat->get_feature_class() != C_DENSE ||
147  feat->get_feature_type() != F_DREAL)
148  SG_ERROR("LDA requires SIMPLE REAL valued features\n")
149 
151  }
152 
154  virtual const char* get_name() const { return "LDA"; }
155 
156  protected:
165  virtual bool train_machine(CFeatures* data=NULL);
166 
167  protected:
168 
169  void init();
170 
175 };
176 }
177 #endif//HAVE_EIGEN3
178 #endif//ifndef

SHOGUN Machine Learning Toolbox - Documentation