aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
iti.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
48
49// =========================================================================
50#ifndef GUM_ITI_H
51#define GUM_ITI_H
52// =========================================================================
54// =========================================================================
55// =========================================================================
57
58// =========================================================================
59// =========================================================================
60
61namespace gum {
62
77
78 template < TESTNAME AttributeSelection, bool isScalar = false >
79 class ITI: public IncrementalGraphLearner< AttributeSelection, isScalar > {
80 public:
81 // ###################################################################
83 // ###################################################################
85
86 // ==========================================================================
98 // ==========================================================================
100 double attributeSelectionThreshold,
101 gum::VariableSet attributeListe,
102 const DiscreteVariable* learnedValue);
103
104 // ==========================================================================
114 // ==========================================================================
116 double attributeSelectionThreshold,
117 gum::VariableSet attributeListe);
118
119 // ==========================================================================
121 // ==========================================================================
122 ~ITI() override;
123
125
126 // ###################################################################
128 // ###################################################################
130
131 public:
132 // ==========================================================================
137 // ==========================================================================
138 void addObservation(const Observation* obs) override;
139
140 protected:
141 // ==========================================================================
148 // ==========================================================================
149 void updateNodeWithObservation_(const Observation* newObs, NodeId currentNodeId) override;
150
152
153 // ###################################################################
155 // ###################################################################
157
158 public:
159 // ==========================================================================
161 // ==========================================================================
162 void updateGraph() override;
163
164 protected:
165 // ==========================================================================
172 // ==========================================================================
174 const DiscreteVariable* boundVar) override;
175
176 // ==========================================================================
182 // ==========================================================================
183 void chgNodeBoundVar_(NodeId chgedNodeId, const DiscreteVariable* desiredVar) override;
184
185 // ==========================================================================
190 // ==========================================================================
191 void removeNode_(NodeId removedNodeId) override;
192
194
195 public:
196 // ###################################################################
198 // ###################################################################
200
201 // ==========================================================================
203 // ==========================================================================
204 void updateFunctionGraph() override;
205
206 private:
207 // ==========================================================================
213 // ==========================================================================
215
216 // ==========================================================================
225 // ==========================================================================
227
228 // ==========================================================================
236 // ==========================================================================
238
239 // ==========================================================================
247 // ==========================================================================
249
251
252
253 protected:
254 // ==========================================================================
259 // ==========================================================================
261
262 private:
267
270
273 };
274
275
276} /* namespace gum */
277
279
280#endif // GUM_ITI_H
Base class for discrete random variable.
void updateFunctionGraph() override
Updates target to currently learned graph structure.
Definition iti_tpl.h:267
NodeId _insertTerminalNode_(NodeId src)
Insert a terminal node in the target.
Definition iti_tpl.h:359
double _attributeSelectionThreshold_
The threshold above which we consider variables to be dependant.
Definition iti.h:272
void removeNode_(NodeId removedNodeId) override
Removes a node from the internal graph.
Definition iti_tpl.h:254
HashTable< NodeId, bool > _staleTable_
Hashtable indicating if given node has been modified (upon receiving new exemple or through a transpo...
Definition iti.h:266
void updateGraph() override
Updates the internal graph after a new observation has been added.
Definition iti_tpl.h:161
NodeId _insertNodeInFunctionGraph_(NodeId src)
Inserts an internal node in the target.
Definition iti_tpl.h:280
Idx _nbTotalObservation_
The total number of observation added to this tree.
Definition iti.h:269
ITI(MultiDimFunctionGraph< double > *target, double attributeSelectionThreshold, gum::VariableSet attributeListe, const DiscreteVariable *learnedValue)
ITI constructor for functions describing the behaviour of one variable according to a set of other va...
Definition iti_tpl.h:85
NodeId insertNode_(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar) override
inserts a new node in internal graph
Definition iti_tpl.h:222
void insertSetOfVars_(MultiDimFunctionGraph< double > *ret)
insertSetOfVars_
Definition iti_tpl.h:364
void addObservation(const Observation *obs) override
Inserts a new observation.
Definition iti_tpl.h:131
void chgNodeBoundVar_(NodeId chgedNodeId, const DiscreteVariable *desiredVar) override
Changes the associated variable of a node.
Definition iti_tpl.h:238
~ITI() override
Default destructor.
Definition iti_tpl.h:353
void updateNodeWithObservation_(const Observation *newObs, NodeId currentNodeId) override
Will update internal graph's NodeDatabase of given node with the new observation.
Definition iti_tpl.h:145
IncrementalGraphLearner(MultiDimFunctionGraph< double > *target, gum::VariableSet attributesSet, const DiscreteVariable *learnVariable)
<agrum/FMDP/learning/datastructure/nodeDatabase.h>
Size Idx
Type for indexes.
Definition types.h:79
Size NodeId
Type for node ids.
Headers of the interface specifying functions to be implemented by any incremental learner.
Priority queues in which the same element can appear several times.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
Set< const DiscreteVariable * > VariableSet