SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
multiclass
MulticlassLibLinear.h
浏览该文件的文档.
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 _MULTICLASSLIBLINEAR_H___
12
#define _MULTICLASSLIBLINEAR_H___
13
#include <
shogun/lib/config.h
>
14
#include <
shogun/lib/common.h
>
15
#include <
shogun/features/DotFeatures.h
>
16
#include <
shogun/machine/LinearMulticlassMachine.h
>
17
#include <
shogun/optimization/liblinear/shogun_liblinear.h
>
18
19
namespace
shogun
20
{
21
36
class
CMulticlassLibLinear
:
public
CLinearMulticlassMachine
37
{
38
public
:
39
MACHINE_PROBLEM_TYPE
(
PT_MULTICLASS
)
40
41
42
CMulticlassLibLinear
();
43
49
CMulticlassLibLinear
(
float64_t
C,
CDotFeatures
* features,
CLabels
* labs);
50
52
virtual
~CMulticlassLibLinear
();
53
55
virtual
const
char
*
get_name
()
const
56
{
57
return
"MulticlassLibLinear"
;
58
}
59
63
inline
void
set_C
(
float64_t
C)
64
{
65
ASSERT
(C>0)
66
m_C
= C;
67
}
71
inline
float64_t
get_C
()
const
{
return
m_C
; }
72
76
inline
void
set_epsilon
(
float64_t
epsilon
)
77
{
78
ASSERT
(epsilon>0)
79
m_epsilon
=
epsilon
;
80
}
84
inline
float64_t
get_epsilon
()
const
{
return
m_epsilon
; }
85
89
inline
void
set_use_bias
(
bool
use_bias)
90
{
91
m_use_bias
= use_bias;
92
}
96
inline
bool
get_use_bias
()
const
97
{
98
return
m_use_bias
;
99
}
100
104
inline
void
set_save_train_state
(
bool
save_train_state)
105
{
106
m_save_train_state
= save_train_state;
107
}
111
inline
bool
get_save_train_state
()
const
112
{
113
return
m_save_train_state
;
114
}
115
119
inline
void
set_max_iter
(int32_t max_iter)
120
{
121
ASSERT
(max_iter>0)
122
m_max_iter
= max_iter;
123
}
127
inline
int32_t
get_max_iter
()
const
{
return
m_max_iter
; }
128
130
void
reset_train_state
()
131
{
132
if
(
m_train_state
)
133
{
134
delete
m_train_state
;
135
m_train_state
= NULL;
136
}
137
}
138
142
SGVector<int32_t>
get_support_vectors
()
const
;
143
144
protected
:
145
147
virtual
bool
train_machine
(
CFeatures
* data = NULL);
148
150
virtual
SGMatrix<float64_t>
obtain_regularizer_matrix
()
const
;
151
152
private
:
153
155
void
init_defaults();
156
158
void
register_parameters();
159
160
protected
:
161
163
float64_t
m_C
;
164
166
float64_t
m_epsilon
;
167
169
int32_t
m_max_iter
;
170
172
bool
m_use_bias
;
173
175
bool
m_save_train_state
;
176
178
mcsvm_state*
m_train_state
;
179
};
180
}
181
#endif
SHOGUN
机器学习工具包 - 项目文档