SHOGUN
3.2.1
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
shogun
classifier
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
>
18
#include <
shogun/features/Features.h
>
19
#include <
shogun/features/DenseFeatures.h
>
20
#include <
shogun/machine/LinearMachine.h
>
21
22
namespace
shogun
23
{
24
template
<
class
ST>
class
CDenseFeatures
;
52
class
CLDA
:
public
CLinearMachine
53
{
54
public
:
55
MACHINE_PROBLEM_TYPE
(
PT_BINARY
);
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
85
inline
float64_t
get_gamma
()
86
{
87
return
m_gamma
;
88
}
89
94
virtual
EMachineType
get_classifier_type
()
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
109
CLinearMachine::set_features
(feat);
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
:
128
float64_t
m_gamma
;
129
};
130
}
131
#endif
132
#endif
SHOGUN
Machine Learning Toolbox - Documentation