SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
multiclass
MulticlassOneVsOneStrategy.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
#include <
shogun/multiclass/MulticlassStrategy.h
>
13
14
namespace
shogun
15
{
16
28
class
CMulticlassOneVsOneStrategy
:
public
CMulticlassStrategy
29
{
30
public
:
32
CMulticlassOneVsOneStrategy
();
33
37
CMulticlassOneVsOneStrategy
(
EProbHeuristicType
prob_heuris);
38
40
virtual
~CMulticlassOneVsOneStrategy
() {}
41
43
virtual
void
train_start
(
CMulticlassLabels
*orig_labels,
CBinaryLabels
*train_labels);
44
46
virtual
bool
train_has_more
();
47
51
virtual
SGVector<int32_t>
train_prepare_next
();
52
56
virtual
int32_t
decide_label
(
SGVector<float64_t>
outputs);
57
60
virtual
int32_t
get_num_machines
()
61
{
62
return
m_num_classes
*(
m_num_classes
-1)/2;
63
}
64
66
virtual
const
char
*
get_name
()
const
67
{
68
return
"MulticlassOneVsOneStrategy"
;
69
};
70
75
virtual
void
rescale_outputs
(
SGVector<float64_t>
outputs);
76
81
void
set_num_classes
(int32_t num_classes)
82
{
83
CMulticlassStrategy::set_num_classes
(num_classes);
84
m_num_machines
=
m_num_classes
*(
m_num_classes
-1)/2;
85
}
86
87
protected
:
93
void
rescale_heuris_price
(
SGVector<float64_t>
outputs,
94
const
SGVector<int32_t>
indx1,
const
SGVector<int32_t>
indx2);
95
101
void
rescale_heuris_hastie
(
SGVector<float64_t>
outputs,
102
const
SGVector<int32_t>
indx1,
const
SGVector<int32_t>
indx2);
103
109
void
rescale_heuris_hamamura
(
SGVector<float64_t>
outputs,
110
const
SGVector<int32_t>
indx1,
const
SGVector<int32_t>
indx2);
111
112
private
:
114
void
register_parameters();
115
116
protected
:
117
int32_t
m_num_machines
;
118
int32_t
m_train_pair_idx_1
;
119
int32_t
m_train_pair_idx_2
;
120
SGVector<int32_t>
m_num_samples
;
121
};
122
123
}
// namespace shogun
SHOGUN
机器学习工具包 - 项目文档