SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 #include <shogun/lib/common.h>
21 
22 namespace shogun
23 {
24 
27 {
31  AUTO_LDA = 10,
34  SVD_LDA = 20,
37  FLD_LDA = 30
38 };
39 
40 template <class ST> class CDenseFeatures;
89 class CLDA : public CLinearMachine
90 {
91  public:
93 
99  CLDA(float64_t gamma=0, ELDAMethod method=AUTO_LDA);
100 
109  CLDA(float64_t gamma, CDenseFeatures<float64_t>* traindat, CLabels* trainlab, ELDAMethod method=AUTO_LDA);
110  virtual ~CLDA();
111 
116  inline void set_gamma(float64_t gamma)
117  {
118  m_gamma=gamma;
119  }
120 
126  {
127  return m_gamma;
128  }
129 
135  {
136  return CT_LDA;
137  }
138 
143  virtual void set_features(CDotFeatures* feat)
144  {
145  if (feat->get_feature_class() != C_DENSE ||
146  feat->get_feature_type() != F_DREAL)
147  SG_ERROR("LDA requires SIMPLE REAL valued features\n")
148 
150  }
151 
153  virtual const char* get_name() const { return "LDA"; }
154 
155  protected:
164  virtual bool train_machine(CFeatures* data=NULL);
165 
166  protected:
167 
168  void init();
169 
174 };
175 }
176 #endif//ifndef
virtual bool train_machine(CFeatures *data=NULL)
Definition: LDA.cpp:58
EMachineType
Definition: Machine.h:33
The class DenseFeatures implements dense feature matrices.
Definition: LDA.h:40
virtual EMachineType get_classifier_type()
Definition: LDA.h:134
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:43
#define SG_ERROR(...)
Definition: SGIO.h:129
float64_t get_gamma()
Definition: LDA.h:125
virtual void set_features(CDotFeatures *feat)
Definition: LDA.h:143
Features that support dot products among other operations.
Definition: DotFeatures.h:44
Class LDA implements regularized Linear Discriminant Analysis.
Definition: LDA.h:89
virtual const char * get_name() const
Definition: LDA.h:153
MACHINE_PROBLEM_TYPE(PT_BINARY)
CLDA(float64_t gamma=0, ELDAMethod method=AUTO_LDA)
Definition: LDA.cpp:25
double float64_t
Definition: common.h:50
virtual void set_features(CDotFeatures *feat)
float64_t m_gamma
Definition: LDA.h:171
virtual EFeatureClass get_feature_class() const =0
Class LinearMachine is a generic interface for all kinds of linear machines like classifiers.
Definition: LinearMachine.h:63
ELDAMethod
Definition: LDA.h:26
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
virtual ~CLDA()
Definition: LDA.cpp:54
The class Features is the base class of all feature objects.
Definition: Features.h:68
void init()
Definition: LDA.cpp:44
ELDAMethod m_method
Definition: LDA.h:173
void set_gamma(float64_t gamma)
Definition: LDA.h:116
virtual EFeatureType get_feature_type() const =0

SHOGUN Machine Learning Toolbox - Documentation