SHOGUN
v3.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.cpp
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
* Written (W) 2013 Shell Hu and Heiko Strathmann
9
* Copyright (C) 2012 Chiyuan Zhang
10
*/
11
12
#include <
shogun/multiclass/MulticlassStrategy.h
>
13
#include <
shogun/mathematics/Math.h
>
14
15
using namespace
shogun;
16
17
18
CMulticlassStrategy::CMulticlassStrategy
()
19
:
CSGObject
()
20
{
21
init();
22
}
23
24
CMulticlassStrategy::CMulticlassStrategy
(
EProbHeuristicType
prob_heuris)
25
:
CSGObject
()
26
{
27
init();
28
29
m_prob_heuris
=prob_heuris;
30
}
31
32
void
CMulticlassStrategy::init()
33
{
34
m_rejection_strategy
=NULL;
35
m_train_labels
=NULL;
36
m_orig_labels
=NULL;
37
m_train_iter
=0;
38
m_prob_heuris
=
PROB_HEURIS_NONE
;
39
m_num_classes
=0;
40
41
SG_ADD
((
CSGObject
**)&
m_rejection_strategy
,
"rejection_strategy"
,
"Strategy of rejection"
,
MS_NOT_AVAILABLE
);
42
SG_ADD
(&
m_num_classes
,
"num_classes"
,
"Number of classes"
,
MS_NOT_AVAILABLE
);
43
//SG_ADD((machine_int_t*)&m_prob_heuris, "prob_heuris", "Probability estimation heuristics", MS_NOT_AVAILABLE);
44
45
SG_WARNING
(
"%s::CMulticlassStrategy(): register parameters!\n"
,
get_name
());
46
}
47
48
void
CMulticlassStrategy::train_start
(
CMulticlassLabels
*orig_labels,
CBinaryLabels
*train_labels)
49
{
50
if
(
m_train_labels
!= NULL)
51
SG_ERROR
(
"Stop the previous training task before starting a new one!"
)
52
SG_REF
(train_labels);
53
m_train_labels
=train_labels;
54
SG_REF
(orig_labels);
55
m_orig_labels
=orig_labels;
56
m_train_iter
=0;
57
}
58
59
SGVector<int32_t>
CMulticlassStrategy::train_prepare_next
()
60
{
61
m_train_iter
++;
62
return
SGVector<int32_t>
();
63
}
64
65
void
CMulticlassStrategy::train_stop
()
66
{
67
SG_UNREF
(
m_train_labels
);
68
SG_UNREF
(
m_orig_labels
);
69
m_train_labels
= NULL;
70
m_orig_labels
= NULL;
71
}
SHOGUN
Machine Learning Toolbox - Documentation