aGrUM  0.14.2
iti.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
27 // =========================================================================
28 #ifndef GUM_ITI_H
29 #define GUM_ITI_H
30 // =========================================================================
32 // =========================================================================
34 // =========================================================================
37 // =========================================================================
39 // =========================================================================
40 
41 namespace gum {
42 
58  template < TESTNAME AttributeSelection, bool isScalar = false >
59  class ITI : public IncrementalGraphLearner< AttributeSelection, isScalar > {
60  public:
61  // ###################################################################
63  // ###################################################################
65 
66  // ==========================================================================
78  // ==========================================================================
80  double attributeSelectionThreshold,
81  Set< const DiscreteVariable* > attributeListe,
82  const DiscreteVariable* learnedValue);
83 
84  // ==========================================================================
94  // ==========================================================================
96  double attributeSelectionThreshold,
97  Set< const DiscreteVariable* > attributeListe);
98 
99  // ==========================================================================
101  // ==========================================================================
102  ~ITI() { GUM_DESTRUCTOR(ITI); }
103 
105 
106  // ###################################################################
108  // ###################################################################
110  public:
111  // ==========================================================================
116  // ==========================================================================
117  void addObservation(const Observation* obs);
118 
119  protected:
120  // ==========================================================================
127  // ==========================================================================
128  void _updateNodeWithObservation(const Observation* newObs,
129  NodeId currentNodeId);
130 
132 
133  // ###################################################################
135  // ###################################################################
137  public:
138  // ==========================================================================
140  // ==========================================================================
141  void updateGraph();
142 
143  protected:
144  // ==========================================================================
151  // ==========================================================================
153  const DiscreteVariable* boundVar);
154 
155  // ==========================================================================
161  // ==========================================================================
162  void _chgNodeBoundVar(NodeId chgedNodeId, const DiscreteVariable* desiredVar);
163 
164  // ==========================================================================
169  // ==========================================================================
170  void _removeNode(NodeId removedNodeId);
171 
173 
174  public:
175  // ###################################################################
177  // ###################################################################
179 
180  // ==========================================================================
182  // ==========================================================================
183  void updateFunctionGraph();
184 
185  private:
186  // ==========================================================================
192  // ==========================================================================
194 
195  // ==========================================================================
204  // ==========================================================================
207  }
208 
209  // ==========================================================================
217  // ==========================================================================
219 
220  // ==========================================================================
228  // ==========================================================================
230 
232 
233 
234  protected:
235  // ==========================================================================
240  // ==========================================================================
243  this->_setOfVars.beginSafe();
244  varIter != this->_setOfVars.endSafe();
245  ++varIter)
246  ret->add(**varIter);
247  }
248 
249  private:
254 
257 
260  };
261 
262 
263 } /* namespace gum */
264 
266 
267 #endif // GUM_ITI_H
Template trick for efficient development.
void updateFunctionGraph()
Updates target to currently learned graph structure.
Definition: iti_tpl.h:258
NodeId _insertNode(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar)
inserts a new node in internal graph
Definition: iti_tpl.h:207
Priority queues in which the same element can appear several times.
Set< const DiscreteVariable *> _setOfVars
NodeId __insertNodeInFunctionGraph(NodeId src)
Inserts an internal node in the target.
Definition: iti_tpl.h:273
double __attributeSelectionThreshold
The threshold above which we consider variables to be dependant.
Definition: iti.h:259
Learn a graphical representation of a function as a decision tree.
Definition: iti.h:59
Base class for discrete random variable.
Safe iterators for the Set classDevelopers may consider using Set<x>::iterator_safe instead of SetIte...
Definition: set.h:808
~ITI()
Default destructor.
Definition: iti.h:102
<agrum/FMDP/learning/datastructure/incrementalGraphLearner>
HashTable< NodeId, bool > __staleTable
Hashtable indicating if given node has been modified (upon receiving new exemple or through a transpo...
Definition: iti.h:253
void updateGraph()
Updates the internal graph after a new observation has been added.
Definition: iti_tpl.h:140
Base class for discrete random variable.
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
void _insertSetOfVars(MultiDimFunctionGraph< double > *ret)
_insertSetOfVars
Definition: iti.h:241
Idx __nbTotalObservation
The total number of observation added to this tree.
Definition: iti.h:256
void _updateNodeWithObservation(const Observation *newObs, NodeId currentNodeId)
Will update internal graph&#39;s NodeDatabase of given node with the new observation. ...
Definition: iti_tpl.h:123
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:162
ITI(MultiDimFunctionGraph< double > *target, double attributeSelectionThreshold, Set< const DiscreteVariable * > 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:58
virtual void add(const DiscreteVariable &v)
Adds a new var to the variables of the multidimensional matrix.
void _removeNode(NodeId removedNodeId)
Removes a node from the internal graph.
Definition: iti_tpl.h:243
Headers of MultiDimFunctionGraph.
Headers of the interface specifying functions to be implemented by any incremental learner...
NodeId __insertTerminalNode(NodeId src)
Insert a terminal node in the target.
Definition: iti.h:205
void _chgNodeBoundVar(NodeId chgedNodeId, const DiscreteVariable *desiredVar)
Changes the associated variable of a node.
Definition: iti_tpl.h:226
Size Idx
Type for indexes.
Definition: types.h:50
void addObservation(const Observation *obs)
Inserts a new observation.
Definition: iti_tpl.h:109
Size NodeId
Type for node ids.
Definition: graphElements.h:97
<agrum/FMDP/learning/datastructure/nodeDatabase.h>
Definition: nodeDatabase.h:55