Public Member Functions | Protected Member Functions | Protected Attributes

CLDA Class Reference

Detailed Description

Class LDA implements regularized Linear Discriminant Analysis.

LDA learns a linear classifier and requires examples to be CSimpleFeatures. The learned linear classification rule is optimal under the assumption that both classes a gaussian distributed with equal co-variance. To find a linear separation ${\bf w}$ in training, the in-between class variance is maximized and the within class variance is minimized, i.e.

\[ J({\bf w})=\frac{{\bf w^T} S_B {\bf w}}{{\bf w^T} S_W {\bf w}} \]

is maximized, where

\[S_b := ({\bf m_{+1}} - {\bf m_{-1}})({\bf m_{+1}} - {\bf m_{-1}})^T \]

is the between class scatter matrix and

\[S_w := \sum_{c\in\{-1,+1\}}\sum_{{\bf x}\in X_{c}}({\bf x} - {\bf m_c})({\bf x} - {\bf m_c})^T \]

is the within class scatter matrix with mean ${\bf m_c} := \frac{1}{N}\sum_{j=1}^N {\bf x_j^c}$ and $X_c:=\{x_1^c, \dots, x_N^c\}$ the set of examples of class c.

LDA is very fast for low-dimensional samples. The regularization parameter $\gamma$ (especially useful in the low sample case) should be tuned in cross-validation.

See also:

Definition at line 52 of file LDA.h.

Inheritance diagram for CLDA:
Inheritance graph

List of all members.

Public Member Functions

 CLDA (float64_t gamma=0)
 CLDA (float64_t gamma, CSimpleFeatures< float64_t > *traindat, CLabels *trainlab)
virtual ~CLDA ()
void set_gamma (float64_t gamma)
float64_t get_gamma ()
virtual EClassifierType get_classifier_type ()
virtual void set_features (CDotFeatures *feat)
virtual const char * get_name () const

Protected Member Functions

virtual bool train_machine (CFeatures *data=NULL)

Protected Attributes

float64_t m_gamma

Constructor & Destructor Documentation

CLDA ( float64_t  gamma = 0  ) 


gamma gamma

Definition at line 23 of file LDA.cpp.

CLDA ( float64_t  gamma,
CSimpleFeatures< float64_t > *  traindat,
CLabels trainlab 


gamma gamma
traindat training features
trainlab labels for training features

Definition at line 28 of file LDA.cpp.

~CLDA (  )  [virtual]

Definition at line 36 of file LDA.cpp.

Member Function Documentation

virtual EClassifierType get_classifier_type (  )  [virtual]

get classifier type

classifier type LDA

Reimplemented from CMachine.

Definition at line 92 of file LDA.h.

float64_t get_gamma (  ) 

get gamma


Definition at line 83 of file LDA.h.

virtual const char* get_name ( void   )  const [virtual]
object name

Reimplemented from CLinearMachine.

Definition at line 111 of file LDA.h.

virtual void set_features ( CDotFeatures feat  )  [virtual]

set features

feat features to set

Reimplemented from CLinearMachine.

Definition at line 101 of file LDA.h.

void set_gamma ( float64_t  gamma  ) 

set gamme

gamma the new gamma

Definition at line 74 of file LDA.h.

bool train_machine ( CFeatures data = NULL  )  [protected, virtual]

train LDA classifier

data training data (parameter can be avoided if distance or kernel-based classifiers are used and distance/kernels are initialized with train data)
whether training was successful

Reimplemented from CMachine.

Definition at line 40 of file LDA.cpp.

Member Data Documentation

float64_t m_gamma [protected]


Definition at line 126 of file LDA.h.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation