aGrUM
3.2.0
a C++ library for (probabilistic) graphical models
Toggle main menu visibility
ITestPolicy.h
Go to the documentation of this file.
1
/****************************************************************************
2
* This file is part of the aGrUM/pyAgrum library. *
3
* *
4
* Copyright (c) 2005-2026 by *
5
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
6
* - Christophe GONZALES(_at_AMU) *
7
* *
8
* The aGrUM/pyAgrum library is free software; you can redistribute it *
9
* and/or modify it under the terms of either : *
10
* *
11
* - the GNU Lesser General Public License as published by *
12
* the Free Software Foundation, either version 3 of the License, *
13
* or (at your option) any later version, *
14
* - the MIT license (MIT), *
15
* - or both in dual license, as here. *
16
* *
17
* (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18
* *
19
* This aGrUM/pyAgrum library is distributed in the hope that it will be *
20
* useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26
* OTHER DEALINGS IN THE SOFTWARE. *
27
* *
28
* See LICENCES for more details. *
29
* *
30
* SPDX-FileCopyrightText: Copyright 2005-2026 *
31
* - Pierre-Henri WUILLEMIN(_at_LIP6) *
32
* - Christophe GONZALES(_at_AMU) *
33
* SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34
* *
35
* Contact : info_at_agrum_dot_org *
36
* homepage : http://agrum.gitlab.io *
37
* gitlab : https://gitlab.com/agrumery/agrum *
38
* *
39
****************************************************************************/
40
41
50
#ifndef GUM_MULTI_DIM_FUNCTION_GRAPH_INTERFACE_TEST_POLICY_H
51
#define GUM_MULTI_DIM_FUNCTION_GRAPH_INTERFACE_TEST_POLICY_H
52
53
// ============================================================================
54
#include <
agrum/base/core/smallobjectallocator/smallObjectAllocator.h
>
55
// ============================================================================
56
#include <
agrum/base/graphs/parts/nodeGraphPart.h
>
57
58
// ============================================================================
59
60
namespace
gum
{
61
70
template
<
typename
GUM_ELEMENT >
71
class
ITestPolicy
{
72
public
:
73
// ############################################################################
75
// ############################################################################
77
78
// ============================================================================
80
// ============================================================================
81
ITestPolicy
();
82
83
// ============================================================================
85
// ============================================================================
86
virtual
~ITestPolicy
();
87
88
// ============================================================================
90
// ============================================================================
91
void
*
operator
new
(
size_t
s);
92
93
void
operator
delete
(
void
* p);
94
96
97
98
// ############################################################################
100
// ############################################################################
102
103
// ============================================================================
105
// ============================================================================
106
virtual
void
addObservation
(
Idx
attr, GUM_ELEMENT value);
107
108
// ============================================================================
110
// ============================================================================
111
Idx
nbObservation
()
const
;
112
114
115
116
// ############################################################################
118
// ############################################################################
120
121
// ============================================================================
124
// ============================================================================
125
virtual
bool
isTestRelevant
()
const
= 0;
126
127
// ============================================================================
129
// ============================================================================
130
virtual
void
computeScore
()
const
;
131
132
// ============================================================================
134
// ============================================================================
135
virtual
double
score
()
const
= 0;
136
137
// ============================================================================
139
// ============================================================================
140
virtual
double
secondaryscore
()
const
= 0;
141
143
144
145
// ############################################################################
147
// ############################################################################
149
150
// ============================================================================
152
// ============================================================================
153
void
add
(
const
ITestPolicy< GUM_ELEMENT >
& src);
154
156
157
158
// ############################################################################
160
// ############################################################################
162
163
// ============================================================================
165
// ============================================================================
166
std::string
toString
()
const
;
167
169
170
protected
:
171
bool
isModified_
()
const
;
172
173
private
:
175
mutable
bool
_isModified_
;
176
178
Idx
_nbObs_
;
179
};
180
181
}
// End of namespace gum
182
183
#include <
agrum/FMDP/learning/core/testPolicy/ITestPolicy_tpl.h
>
184
#endif
/* GUM_MULTI_DIM_FUNCTION_GRAPH_INTERFACE_TEST_POLICY_H */
ITestPolicy_tpl.h
gum::ITestPolicy::ITestPolicy
ITestPolicy()
Allocators and Deallocators redefinition.
Definition
ITestPolicy_tpl.h:49
gum::ITestPolicy::isModified_
bool isModified_() const
Definition
ITestPolicy_tpl.h:97
gum::ITestPolicy::_isModified_
bool _isModified_
Booleans indicating if we have to re eval test.
Definition
ITestPolicy.h:175
gum::ITestPolicy::addObservation
virtual void addObservation(Idx attr, GUM_ELEMENT value)
Comptabilizes the new observation.
Definition
ITestPolicy_tpl.h:70
gum::ITestPolicy::computeScore
virtual void computeScore() const
Recomputes the statistic from the beginning.
Definition
ITestPolicy_tpl.h:81
gum::ITestPolicy::score
virtual double score() const =0
Returns the performance of current variable according to the test.
gum::ITestPolicy::_nbObs_
Idx _nbObs_
Definition
ITestPolicy.h:178
gum::ITestPolicy::isTestRelevant
virtual bool isTestRelevant() const =0
Returns true if enough observation were added so that the test can be relevant.
gum::ITestPolicy::add
void add(const ITestPolicy< GUM_ELEMENT > &src)
Definition
ITestPolicy_tpl.h:86
gum::ITestPolicy::secondaryscore
virtual double secondaryscore() const =0
Returns a second criterion to severe ties.
gum::ITestPolicy::nbObservation
Idx nbObservation() const
Comptabilizes the new observation.
Definition
ITestPolicy_tpl.h:76
gum::ITestPolicy::toString
std::string toString() const
Definition
ITestPolicy_tpl.h:92
gum::Idx
Size Idx
Type for indexes.
Definition
types.h:79
gum
gum is the global namespace for all aGrUM entities
Definition
agrum.h:46
nodeGraphPart.h
Base node set class for graphs.
smallObjectAllocator.h
Headers of gum::SmallObjectAllocator.
aGrUM
3.2.0
© PHW&CG&others - 2022
DoXyGeN 1.18.0