SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
multiclass
MulticlassOneVsRestStrategy.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 Chiyuan Zhang
8
* Written (W) 2013 Shell Hu and Heiko Strathmann
9
* Copyright (C) 2012 Chiyuan Zhang
10
*/
11
12
#ifndef MULTICLASSONEVSRESTSTRATEGY_H__
13
#define MULTICLASSONEVSRESTSTRATEGY_H__
14
15
#include <
shogun/multiclass/MulticlassStrategy.h
>
16
17
namespace
shogun
18
{
19
31
class
CMulticlassOneVsRestStrategy
:
public
CMulticlassStrategy
32
{
33
public
:
35
CMulticlassOneVsRestStrategy
();
36
40
CMulticlassOneVsRestStrategy
(
EProbHeuristicType
prob_heuris);
41
43
virtual
~CMulticlassOneVsRestStrategy
() {}
44
46
virtual
void
train_start
(
CMulticlassLabels
*orig_labels,
CBinaryLabels
*train_labels)
47
{
48
CMulticlassStrategy::train_start
(orig_labels, train_labels);
49
}
50
52
virtual
bool
train_has_more
()
53
{
54
return
m_train_iter
<
m_num_classes
;
55
}
56
60
virtual
SGVector<int32_t>
train_prepare_next
();
61
65
virtual
int32_t
decide_label
(
SGVector<float64_t>
outputs);
66
71
virtual
SGVector<index_t>
decide_label_multiple_output
(
SGVector<float64_t>
outputs, int32_t n_outputs);
72
75
virtual
int32_t
get_num_machines
()
76
{
77
return
m_num_classes
;
78
}
79
81
virtual
const
char
*
get_name
()
const
82
{
83
return
"MulticlassOneVsRestStrategy"
;
84
};
85
89
virtual
void
rescale_outputs
(
SGVector<float64_t>
outputs);
90
97
virtual
void
rescale_outputs
(
SGVector<float64_t>
outputs,
98
const
SGVector<float64_t>
As,
const
SGVector<float64_t>
Bs);
99
100
protected
:
104
void
rescale_heuris_norm
(
SGVector<float64_t>
outputs);
105
111
void
rescale_heuris_softmax
(
SGVector<float64_t>
outputs,
112
const
SGVector<float64_t>
As,
const
SGVector<float64_t>
Bs);
113
114
};
115
116
}
// namespace shogun
117
118
#endif
/* end of include guard: MULTICLASSONEVSRESTSTRATEGY_H__ */
119
SHOGUN
机器学习工具包 - 项目文档