SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
machine
StructuredOutputMachine.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) 2013 Shell Hu
8
* Written (W) 2012 Fernando José Iglesias García
9
* Copyright (C) 2012 Fernando José Iglesias García
10
*/
11
12
#ifndef _STRUCTURED_OUTPUT_MACHINE__H__
13
#define _STRUCTURED_OUTPUT_MACHINE__H__
14
15
#include <
shogun/labels/StructuredLabels.h
>
16
#include <
shogun/lib/StructuredData.h
>
17
#include <
shogun/machine/Machine.h
>
18
#include <
shogun/structure/StructuredModel.h
>
19
#include <
shogun/loss/LossFunction.h
>
20
#include <
shogun/structure/SOSVMHelper.h
>
21
22
namespace
shogun
23
{
24
30
enum
EStructRiskType
31
{
32
N_SLACK_MARGIN_RESCALING
= 0,
33
N_SLACK_SLACK_RESCALING
= 1,
34
ONE_SLACK_MARGIN_RESCALING
= 2,
35
ONE_SLACK_SLACK_RESCALING
= 3,
36
CUSTOMIZED_RISK
= 4
37
};
38
39
class
CStructuredModel;
40
42
class
CStructuredOutputMachine
:
public
CMachine
43
{
44
public
:
46
MACHINE_PROBLEM_TYPE
(
PT_STRUCTURED
);
47
49
CStructuredOutputMachine
();
50
56
CStructuredOutputMachine
(
CStructuredModel
* model,
CStructuredLabels
* labs);
57
59
virtual
~CStructuredOutputMachine
();
60
65
void
set_model
(
CStructuredModel
* model);
66
71
CStructuredModel
*
get_model
()
const
;
72
74
virtual
const
char
*
get_name
()
const
75
{
76
return
"StructuredOutputMachine"
;
77
}
78
83
virtual
void
set_labels
(
CLabels
* lab);
84
89
void
set_features
(
CFeatures
* f);
90
95
CFeatures
*
get_features
()
const
;
96
101
void
set_surrogate_loss
(
CLossFunction
* loss);
102
107
CLossFunction
*
get_surrogate_loss
()
const
;
108
117
virtual
float64_t
risk
(
float64_t
* subgrad,
float64_t
* W,
118
TMultipleCPinfo
* info=0,
EStructRiskType
rtype =
N_SLACK_MARGIN_RESCALING
);
119
121
CSOSVMHelper
*
get_helper
()
const
;
122
129
void
set_verbose
(
bool
verbose);
130
135
bool
get_verbose
()
const
;
136
137
protected
:
165
virtual
float64_t
risk_nslack_margin_rescale
(
float64_t
* subgrad,
float64_t
* W,
TMultipleCPinfo
* info=0);
166
174
virtual
float64_t
risk_nslack_slack_rescale
(
float64_t
* subgrad,
float64_t
* W,
TMultipleCPinfo
* info=0);
175
183
virtual
float64_t
risk_1slack_margin_rescale
(
float64_t
* subgrad,
float64_t
* W,
TMultipleCPinfo
* info=0);
184
192
virtual
float64_t
risk_1slack_slack_rescale
(
float64_t
* subgrad,
float64_t
* W,
TMultipleCPinfo
* info=0);
193
201
virtual
float64_t
risk_customized_formulation
(
float64_t
* subgrad,
float64_t
* W,
TMultipleCPinfo
* info=0);
202
203
private
:
205
void
register_parameters();
206
207
protected
:
209
CStructuredModel
*
m_model
;
210
215
CLossFunction
*
m_surrogate_loss
;
216
218
CSOSVMHelper
*
m_helper
;
219
221
bool
m_verbose
;
222
223
};
/* class CStructuredOutputMachine */
224
225
}
/* namespace shogun */
226
227
#endif
/* _STRUCTURED_OUTPUT_MACHINE__H__ */
SHOGUN
机器学习工具包 - 项目文档