SHOGUN  v3.2.0
 全部  命名空间 文件 函数 变量 类型定义 枚举 枚举值 友元 宏定义  
LDA.h
浏览该文件的文档.
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 CDenseFeatures;
52 class CLDA : public CLinearMachine
53 {
54  public:
56 
61  CLDA(float64_t gamma=0);
62 
69  CLDA(float64_t gamma, CDenseFeatures<float64_t>* traindat, CLabels* trainlab);
70  virtual ~CLDA();
71 
76  inline void set_gamma(float64_t gamma)
77  {
78  m_gamma=gamma;
79  }
80 
86  {
87  return m_gamma;
88  }
89 
95  {
96  return CT_LDA;
97  }
98 
103  virtual void set_features(CDotFeatures* feat)
104  {
105  if (feat->get_feature_class() != C_DENSE ||
106  feat->get_feature_type() != F_DREAL)
107  SG_ERROR("LDA requires SIMPLE REAL valued features\n")
108 
110  }
111 
113  virtual const char* get_name() const { return "LDA"; }
114 
115  protected:
124  virtual bool train_machine(CFeatures* data=NULL);
125 
126  protected:
129 };
130 }
131 #endif
132 #endif
virtual bool train_machine(CFeatures *data=NULL)
Definition: LDA.cpp:41
EMachineType
Definition: Machine.h:33
virtual EMachineType get_classifier_type()
Definition: LDA.h:94
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:35
#define SG_ERROR(...)
Definition: SGIO.h:131
float64_t get_gamma()
Definition: LDA.h:85
virtual void set_features(CDotFeatures *feat)
Definition: LDA.h:103
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:113
CLDA(float64_t gamma=0)
Definition: LDA.cpp:24
MACHINE_PROBLEM_TYPE(PT_BINARY)
double float64_t
Definition: common.h:48
virtual void set_features(CDotFeatures *feat)
float64_t m_gamma
Definition: LDA.h:128
virtual EFeatureClass get_feature_class() const =0
Class LinearMachine is a generic interface for all kinds of linear machines like classifiers.
Definition: LinearMachine.h:61
The class DenseFeatures implements dense feature matrices.
Definition: LDA.h:24
virtual ~CLDA()
Definition: LDA.cpp:37
The class Features is the base class of all feature objects.
Definition: Features.h:62
void set_gamma(float64_t gamma)
Definition: LDA.h:76
virtual EFeatureType get_feature_type() const =0

SHOGUN Machine Learning Toolbox - Documentation