SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _LDA_H___
12 #define _LDA_H___
13 
14 #include <shogun/lib/config.h>
15 
16 #ifdef HAVE_LAPACK
17 #include <shogun/lib/common.h>
21 
22 namespace shogun
23 {
24  template <class ST> class CSimpleFeatures;
52 class CLDA : public CLinearMachine
53 {
54  public:
59  CLDA(float64_t gamma=0);
60 
67  CLDA(float64_t gamma, CSimpleFeatures<float64_t>* traindat, CLabels* trainlab);
68  virtual ~CLDA();
69 
74  inline void set_gamma(float64_t gamma)
75  {
76  m_gamma=gamma;
77  }
78 
84  {
85  return m_gamma;
86  }
87 
93  {
94  return CT_LDA;
95  }
96 
101  virtual inline void set_features(CDotFeatures* feat)
102  {
103  if (feat->get_feature_class() != C_SIMPLE ||
104  feat->get_feature_type() != F_DREAL)
105  SG_ERROR("LDA requires SIMPLE REAL valued features\n");
106 
108  }
109 
111  inline virtual const char* get_name() const { return "LDA"; }
112 
113  protected:
122  virtual bool train_machine(CFeatures* data=NULL);
123 
124  protected:
127 };
128 }
129 #endif
130 #endif
virtual bool train_machine(CFeatures *data=NULL)
Definition: LDA.cpp:40
virtual EClassifierType get_classifier_type()
Definition: LDA.h:92
virtual EFeatureType get_feature_type()=0
EClassifierType
Definition: Machine.h:27
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:35
#define SG_ERROR(...)
Definition: SGIO.h:75
float64_t get_gamma()
Definition: LDA.h:83
virtual void set_features(CDotFeatures *feat)
Definition: LDA.h:101
Features that support dot products among other operations.
Definition: DotFeatures.h:41
Class LDA implements regularized Linear Discriminant Analysis.
Definition: LDA.h:52
virtual const char * get_name() const
Definition: LDA.h:111
virtual EFeatureClass get_feature_class()=0
CLDA(float64_t gamma=0)
Definition: LDA.cpp:23
double float64_t
Definition: common.h:56
float64_t m_gamma
Definition: LDA.h:126
Class LinearMachine is a generic interface for all kinds of linear machines like classifiers.
Definition: LinearMachine.h:61
virtual ~CLDA()
Definition: LDA.cpp:36
The class Features is the base class of all feature objects.
Definition: Features.h:56
virtual void set_features(CDotFeatures *feat)
The class SimpleFeatures implements dense feature matrices.
Definition: LDA.h:24
void set_gamma(float64_t gamma)
Definition: LDA.h:74

SHOGUN Machine Learning Toolbox - Documentation