SHOGUN
v3.0.0
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
multiclass
MulticlassOCAS.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) 2012 Sergey Lisitsyn
8
* Copyright (C) 2012 Sergey Lisitsyn
9
*/
10
11
#ifndef _MULTICLASSOCAS_H___
12
#define _MULTICLASSOCAS_H___
13
14
#include <
shogun/lib/common.h
>
15
#include <
shogun/features/DotFeatures.h
>
16
#include <shogun/lib/external/libocas.h>
17
#include <
shogun/machine/LinearMulticlassMachine.h
>
18
19
namespace
shogun
20
{
21
23
class
CMulticlassOCAS
:
public
CLinearMulticlassMachine
24
{
25
public
:
26
MACHINE_PROBLEM_TYPE
(
PT_MULTICLASS
)
27
28
29
CMulticlassOCAS
();
30
36
CMulticlassOCAS
(
float64_t
C,
CDotFeatures
* features,
CLabels
* labs);
37
39
virtual
~CMulticlassOCAS
();
40
42
virtual
const
char
*
get_name
()
const
43
{
44
return
"MulticlassOCAS"
;
45
}
46
50
inline
void
set_C
(
float64_t
C)
51
{
52
ASSERT
(C>0)
53
m_C
= C;
54
}
58
inline
float64_t
get_C
()
const
{
return
m_C
; }
59
63
inline
void
set_epsilon
(
float64_t
epsilon
)
64
{
65
ASSERT
(epsilon>0)
66
m_epsilon
=
epsilon
;
67
}
71
inline
float64_t
get_epsilon
()
const
{
return
m_epsilon
; }
72
76
inline
void
set_max_iter
(int32_t max_iter)
77
{
78
ASSERT
(max_iter>0)
79
m_max_iter
= max_iter;
80
}
84
inline
int32_t
get_max_iter
()
const
{
return
m_max_iter
; }
85
89
inline
void
set_method
(int32_t method)
90
{
91
ASSERT
(method==0 || method==1)
92
m_method
= method;
93
}
97
inline
int32_t
get_method
()
const
{
return
m_method
; }
98
102
inline
void
set_buf_size
(int32_t buf_size)
103
{
104
ASSERT
(buf_size>0)
105
m_buf_size
= buf_size;
106
}
110
inline
int32_t
get_buf_size
()
const
{
return
m_buf_size
; }
111
112
protected
:
113
115
virtual
bool
train_machine
(
CFeatures
* data = NULL);
116
118
static
float64_t
msvm_update_W
(
float64_t
t,
void
* user_data);
119
121
static
void
msvm_full_compute_W
(
float64_t
*sq_norm_W,
float64_t
*dp_WoldW,
122
float64_t
*alpha, uint32_t nSel,
void
* user_data);
123
125
static
int
msvm_full_add_new_cut
(
float64_t
*new_col_H, uint32_t *new_cut,
126
uint32_t nSel,
void
* user_data);
127
129
static
int
msvm_full_compute_output
(
float64_t
*output,
void
* user_data);
130
132
static
int
msvm_sort_data
(
float64_t
* vals,
float64_t
* data, uint32_t size);
133
135
static
void
msvm_print
(ocas_return_value_T value);
136
137
private
:
138
140
void
register_parameters();
141
142
protected
:
143
145
float64_t
m_C
;
146
148
float64_t
m_epsilon
;
149
151
int32_t
m_max_iter
;
152
154
int32_t
m_method
;
155
157
int32_t
m_buf_size
;
158
};
159
}
160
#endif
SHOGUN
Machine Learning Toolbox - Documentation