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
SVM.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 _SVM_H___
12
#define _SVM_H___
13
14
#include <
shogun/lib/common.h
>
15
#include <
shogun/features/Features.h
>
16
#include <
shogun/kernel/Kernel.h
>
17
#include <
shogun/machine/KernelMachine.h
>
18
19
namespace
shogun
20
{
21
22
class
CMKL;
23
46
class
CSVM
:
public
CKernelMachine
47
{
48
public
:
52
CSVM
(int32_t num_sv=0);
53
61
CSVM
(
float64_t
C,
CKernel
* k,
CLabels
* lab);
62
virtual
~CSVM
();
63
66
void
set_defaults
(int32_t num_sv=0);
67
68
74
virtual
SGVector<float64_t>
get_linear_term
();
75
76
82
virtual
void
set_linear_term
(
SGVector<float64_t>
linear_term);
83
84
88
bool
load
(FILE* svm_file);
89
93
bool
save
(FILE* svm_file);
94
99
inline
void
set_nu
(
float64_t
nue) {
nu
=nue; }
100
101
110
inline
void
set_C
(
float64_t
c_neg,
float64_t
c_pos) {
C1
=c_neg;
C2
=c_pos; }
111
112
117
inline
void
set_epsilon
(
float64_t
eps) {
epsilon
=eps; }
118
123
inline
void
set_tube_epsilon
(
float64_t
eps) {
tube_epsilon
=eps; }
124
129
inline
float64_t
get_tube_epsilon
() {
return
tube_epsilon
; }
130
135
inline
void
set_qpsize
(int32_t qps) {
qpsize
=qps; }
136
141
inline
float64_t
get_epsilon
() {
return
epsilon
; }
142
147
inline
float64_t
get_nu
() {
return
nu
; }
148
153
inline
float64_t
get_C1
() {
return
C1
; }
154
159
inline
float64_t
get_C2
() {
return
C2
; }
160
165
inline
int32_t
get_qpsize
() {
return
qpsize
; }
166
171
inline
void
set_shrinking_enabled
(
bool
enable)
172
{
173
use_shrinking
=enable;
174
}
175
180
inline
bool
get_shrinking_enabled
()
181
{
182
return
use_shrinking
;
183
}
184
189
float64_t
compute_svm_dual_objective
();
190
195
float64_t
compute_svm_primal_objective
();
196
201
inline
void
set_objective
(
float64_t
v)
202
{
203
objective
=v;
204
}
205
210
inline
float64_t
get_objective
()
211
{
212
return
objective
;
213
}
214
222
void
set_callback_function
(
CMKL
* m,
bool
(*cb)
223
(
CMKL
*
mkl
,
const
float64_t
* sumw,
const
float64_t
suma));
224
226
inline
virtual
const
char
*
get_name
()
const
{
return
"SVM"
; }
227
228
protected
:
229
235
virtual
float64_t
*
get_linear_term_array
();
236
238
SGVector<float64_t>
m_linear_term
;
239
241
bool
svm_loaded
;
243
float64_t
epsilon
;
245
float64_t
tube_epsilon
;
247
float64_t
nu
;
249
float64_t
C1
;
251
float64_t
C2
;
253
float64_t
objective
;
255
int32_t
qpsize
;
257
bool
use_shrinking
;
258
261
bool (*
callback
) (
CMKL
*
mkl
,
const
float64_t
* sumw,
const
float64_t
suma);
264
CMKL
*
mkl
;
265
};
266
}
267
#endif
SHOGUN
Machine Learning Toolbox - Documentation