SHOGUN
v1.1.0
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
shogun
classifier
svm
SVMSGD.h
Go to the documentation of this file.
1
#ifndef _SVMSGD_H___
2
#define _SVMSGD_H___
3
4
/*
5
SVM with stochastic gradient
6
Copyright (C) 2007- Leon Bottou
7
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
13
This program is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with this program; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA
21
22
Shogun adjustments (w) 2008 Soeren Sonnenburg
23
*/
24
25
#include <
shogun/lib/common.h
>
26
#include <
shogun/machine/LinearMachine.h
>
27
#include <
shogun/features/DotFeatures.h
>
28
#include <
shogun/features/Labels.h
>
29
#include <
shogun/loss/LossFunction.h
>
30
31
namespace
shogun
32
{
34
class
CSVMSGD
:
public
CLinearMachine
35
{
36
public
:
38
CSVMSGD
();
39
44
CSVMSGD
(
float64_t
C);
45
52
CSVMSGD
(
53
float64_t
C,
CDotFeatures
* traindat,
54
CLabels
* trainlab);
55
56
virtual
~CSVMSGD
();
57
62
virtual
inline
EClassifierType
get_classifier_type
() {
return
CT_SVMSGD
; }
63
70
inline
void
set_C
(
float64_t
c_neg,
float64_t
c_pos) { C1=c_neg; C2=c_pos; }
71
76
inline
float64_t
get_C1
() {
return
C1; }
77
82
inline
float64_t
get_C2
() {
return
C2; }
83
88
inline
void
set_epochs
(int32_t e) { epochs=e; }
89
94
inline
int32_t
get_epochs
() {
return
epochs; }
95
100
inline
void
set_bias_enabled
(
bool
enable_bias) { use_bias=enable_bias; }
101
106
inline
bool
get_bias_enabled
() {
return
use_bias; }
107
112
inline
void
set_regularized_bias_enabled
(
bool
enable_bias) { use_regularized_bias=enable_bias; }
113
118
inline
bool
get_regularized_bias_enabled
() {
return
use_regularized_bias; }
119
124
void
set_loss_function
(
CLossFunction
* loss_func);
125
130
inline
CLossFunction
*
get_loss_function
() {
SG_REF
(loss);
return
loss; }
131
133
inline
virtual
const
char
*
get_name
()
const
{
return
"SVMSGD"
; }
134
135
protected
:
137
void
calibrate
();
138
147
virtual
bool
train_machine
(
CFeatures
* data=NULL);
148
149
private
:
150
void
init();
151
152
private
:
153
float64_t
t;
154
float64_t
C1;
155
float64_t
C2;
156
float64_t
wscale;
157
float64_t
bscale;
158
int32_t epochs;
159
int32_t skip;
160
int32_t count;
161
162
bool
use_bias;
163
bool
use_regularized_bias;
164
165
CLossFunction
* loss;
166
};
167
}
168
#endif
SHOGUN
Machine Learning Toolbox - Documentation