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
statistics
TestStatistic.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-2013 Heiko Strathmann
8
*/
9
10
#include <
shogun/statistics/TestStatistic.h
>
11
#include <
shogun/base/Parameter.h
>
12
13
using namespace
shogun;
14
15
CTestStatistic::CTestStatistic
() :
CSGObject
()
16
{
17
init();
18
}
19
20
CTestStatistic::~CTestStatistic
()
21
{
22
23
}
24
25
void
CTestStatistic::init()
26
{
27
SG_ADD
(&
m_bootstrap_iterations
,
"bootstrap_iterations"
,
28
"Number of iterations for bootstrapping"
,
MS_NOT_AVAILABLE
);
29
SG_ADD
((
machine_int_t
*)&
m_null_approximation_method
,
30
"null_approximation_method"
,
31
"Method for approximating null distribution"
,
32
MS_NOT_AVAILABLE
);
33
34
m_bootstrap_iterations
=250;
35
m_null_approximation_method
=
BOOTSTRAP
;
36
}
37
38
void
CTestStatistic::set_null_approximation_method
(
39
ENullApproximationMethod
null_approximation_method)
40
{
41
m_null_approximation_method
=null_approximation_method;
42
}
43
44
void
CTestStatistic::set_bootstrap_iterations
(
index_t
45
bootstrap_iterations)
46
{
47
m_bootstrap_iterations
=bootstrap_iterations;
48
}
49
50
float64_t
CTestStatistic::perform_test
()
51
{
52
/* baseline method here is simply to compute statistic and p-value
53
* separately */
54
float64_t
statistic=
compute_statistic
();
55
return
compute_p_value
(statistic);
56
}
57
58
bool
CTestStatistic::perform_test
(
float64_t
alpha)
59
{
60
float64_t
p_value=
perform_test
();
61
return
p_value<alpha;
62
}
SHOGUN
Machine Learning Toolbox - Documentation