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
evaluation
MachineEvaluation.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
* Copyright (C) 2012 Jacob Walker
8
*
9
* Some code adapted from CrossValidation class by
10
* Heiko Strathmann
11
*/
12
13
#include "
MachineEvaluation.h
"
14
#include <
shogun/evaluation/CrossValidation.h
>
15
#include <
shogun/machine/Machine.h
>
16
#include <
shogun/evaluation/Evaluation.h
>
17
#include <
shogun/evaluation/SplittingStrategy.h
>
18
#include <
shogun/base/Parameter.h
>
19
#include <
shogun/base/ParameterMap.h
>
20
#include <
shogun/mathematics/Statistics.h
>
21
22
using namespace
shogun;
23
24
CMachineEvaluation::CMachineEvaluation
()
25
{
26
init
();
27
}
28
29
CMachineEvaluation::CMachineEvaluation
(
CMachine
* machine,
CFeatures
* features,
30
CLabels
* labels,
CSplittingStrategy
* splitting_strategy,
31
CEvaluation
* evaluation_criterion,
bool
autolock)
32
{
33
init
();
34
35
m_machine
= machine;
36
m_features
= features;
37
m_labels
= labels;
38
m_splitting_strategy
= splitting_strategy;
39
m_evaluation_criterion
= evaluation_criterion;
40
m_autolock
= autolock;
41
42
SG_REF
(
m_machine
);
43
SG_REF
(
m_features
);
44
SG_REF
(
m_labels
);
45
SG_REF
(
m_splitting_strategy
);
46
SG_REF
(
m_evaluation_criterion
);
47
}
48
49
CMachineEvaluation::CMachineEvaluation
(
CMachine
* machine,
CLabels
* labels,
50
CSplittingStrategy
* splitting_strategy,
51
CEvaluation
* evaluation_criterion,
bool
autolock)
52
{
53
init
();
54
55
m_machine
= machine;
56
m_labels
= labels;
57
m_splitting_strategy
= splitting_strategy;
58
m_evaluation_criterion
= evaluation_criterion;
59
m_autolock
= autolock;
60
61
SG_REF
(
m_machine
);
62
SG_REF
(
m_labels
);
63
SG_REF
(
m_splitting_strategy
);
64
SG_REF
(
m_evaluation_criterion
);
65
}
66
67
CMachineEvaluation::~CMachineEvaluation
()
68
{
69
SG_UNREF
(
m_machine
);
70
SG_UNREF
(
m_features
);
71
SG_UNREF
(
m_labels
);
72
SG_UNREF
(
m_splitting_strategy
);
73
SG_UNREF
(
m_evaluation_criterion
);
74
}
75
76
void
CMachineEvaluation::init
()
77
{
78
m_machine
= NULL;
79
m_features
= NULL;
80
m_labels
= NULL;
81
m_splitting_strategy
= NULL;
82
m_evaluation_criterion
= NULL;
83
m_do_unlock
=
false
;
84
m_autolock
=
true
;
85
86
SG_ADD
((
CSGObject
**)&
m_machine
,
"machine"
,
"Used learning machine"
,
87
MS_NOT_AVAILABLE
);
88
SG_ADD
((
CSGObject
**)&
m_features
,
"features"
,
"Used features"
,
89
MS_NOT_AVAILABLE
);
90
SG_ADD
((
CSGObject
**)&
m_labels
,
"labels"
,
"Used labels"
,
91
MS_NOT_AVAILABLE
);
92
SG_ADD
((
CSGObject
**)&
m_splitting_strategy
,
"splitting_strategy"
,
93
"Used splitting strategy"
,
MS_NOT_AVAILABLE
);
94
SG_ADD
((
CSGObject
**)&
m_evaluation_criterion
,
"evaluation_criterion"
,
95
"Used evaluation criterion"
,
MS_NOT_AVAILABLE
);
96
SG_ADD
((
CSGObject
**)&
m_do_unlock
,
"do_unlock"
,
97
"Whether machine should be unlocked after evaluation"
,
98
MS_NOT_AVAILABLE
);
99
SG_ADD
((
CSGObject
**)&
m_autolock
,
"m_autolock"
,
100
"Whether machine should automatically try to be locked before "
,
101
MS_NOT_AVAILABLE
);
102
103
/* new parameter from param version 0 to 1 */
104
m_parameter_map
->
put
(
105
new
SGParamInfo
(
"m_do_unlock"
, CT_SCALAR, ST_NONE, PT_BOOL, 1),
106
new
SGParamInfo
()
107
);
108
109
/* new parameter from param version 0 to 1 */
110
m_parameter_map
->
put
(
111
new
SGParamInfo
(
"m_autolock"
, CT_SCALAR, ST_NONE, PT_BOOL, 1),
112
new
SGParamInfo
()
113
);
114
}
115
116
CMachine
*
CMachineEvaluation::get_machine
()
const
117
{
118
SG_REF
(
m_machine
);
119
return
m_machine
;
120
}
121
122
EEvaluationDirection
CMachineEvaluation::get_evaluation_direction
()
123
{
124
return
m_evaluation_criterion
->
get_evaluation_direction
();
125
}
SHOGUN
Machine Learning Toolbox - Documentation