SHOGUN
v2.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
MulticlassStrategy.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 Chiyuan Zhang
8
* Copyright (C) 2012 Chiyuan Zhang
9
*/
10
11
#ifndef MULTICLASSSTRATEGY_H__
12
#define MULTICLASSSTRATEGY_H__
13
14
#include <
shogun/base/SGObject.h
>
15
#include <
shogun/labels/BinaryLabels.h
>
16
#include <
shogun/labels/MulticlassLabels.h
>
17
#include <
shogun/multiclass/RejectionStrategy.h
>
18
19
namespace
shogun
20
{
21
25
class
CMulticlassStrategy
:
public
CSGObject
26
{
27
public
:
29
CMulticlassStrategy
();
30
32
virtual
~CMulticlassStrategy
() {}
33
35
virtual
const
char
*
get_name
()
const
36
{
37
return
"MulticlassStrategy"
;
38
};
39
41
void
set_num_classes
(int32_t num_classes)
42
{
43
m_num_classes
= num_classes;
44
}
45
47
int32_t
get_num_classes
()
const
48
{
49
return
m_num_classes
;
50
}
51
53
CRejectionStrategy
*
get_rejection_strategy
()
54
{
55
SG_REF
(
m_rejection_strategy
);
56
return
m_rejection_strategy
;
57
}
58
60
void
set_rejection_strategy
(
CRejectionStrategy
*rejection_strategy)
61
{
62
SG_REF
(rejection_strategy);
63
SG_UNREF
(
m_rejection_strategy
);
64
m_rejection_strategy
= rejection_strategy;
65
}
66
68
virtual
void
train_start
(
CMulticlassLabels
*orig_labels,
CBinaryLabels
*train_labels);
69
71
virtual
bool
train_has_more
()=0;
72
76
virtual
SGVector<int32_t>
train_prepare_next
();
77
79
virtual
void
train_stop
();
80
84
virtual
int32_t
decide_label
(
SGVector<float64_t>
outputs)=0;
85
90
virtual
SGVector<index_t>
decide_label_multiple_output
(
SGVector<float64_t>
outputs, int32_t n_outputs)
91
{
92
SG_NOTIMPLEMENTED
;
93
return
SGVector<index_t>
();
94
}
95
98
virtual
int32_t
get_num_machines
()=0;
99
100
protected
:
101
102
CRejectionStrategy
*
m_rejection_strategy
;
103
CBinaryLabels
*
m_train_labels
;
104
CMulticlassLabels
*
m_orig_labels
;
105
int32_t
m_train_iter
;
106
int32_t
m_num_classes
;
107
};
108
109
}
// namespace shogun
110
111
#endif
/* end of include guard: MULTICLASSSTRATEGY_H__ */
112
SHOGUN
Machine Learning Toolbox - Documentation