aGrUM  0.14.2
imddi.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_IMDDI_H
29 #define GUM_IMDDI_H
30 // =========================================================================
32 // =========================================================================
38 // =========================================================================
40 // =========================================================================
41 
42 namespace gum {
43 
54  template < TESTNAME AttributeSelection, bool isScalar = false >
55  class IMDDI : public IncrementalGraphLearner< AttributeSelection, isScalar > {
56  public:
57  // ###################################################################
59  // ###################################################################
61 
62  // ==========================================================================
64  // ==========================================================================
66  double attributeSelectionThreshold,
67  double pairSelectionThreshold,
68  Set< const DiscreteVariable* > attributeListe,
69  const DiscreteVariable* learnedValue);
70 
71  // ==========================================================================
73  // ==========================================================================
75  double attributeSelectionThreshold,
76  double pairSelectionThreshold,
77  Set< const DiscreteVariable* > attributeListe);
78 
79  // ==========================================================================
81  // ==========================================================================
82  ~IMDDI();
83 
85 
86  // ###################################################################
88  // ###################################################################
90 
91  // ==========================================================================
93  // ==========================================================================
94  void addObservation(const Observation*);
95 
96  protected:
97  void _updateNodeWithObservation(const Observation* newObs,
98  NodeId currentNodeId);
99 
100  public:
101  // ==========================================================================
103  // ==========================================================================
104  void updateGraph();
105 
106  protected:
108  const DiscreteVariable* boundVar,
109  Set< const Observation* >* sonsMap);
110 
111  void _chgNodeBoundVar(NodeId chgedNodeId, const DiscreteVariable* desiredVar);
112 
113  void _removeNode(NodeId removedNodeId);
114 
115  private:
116  void __addLeaf(NodeId);
117  void __removeLeaf(NodeId);
118 
120 
121  private:
122  // ###################################################################
124  // ###################################################################
126 
127  // ==========================================================================
129  // ==========================================================================
132 
133  // ==========================================================================
137  // ==========================================================================
138  void
140 
141 
142  public:
143  // ==========================================================================
145  // ==========================================================================
146  void updateFunctionGraph();
147 
148  private:
149  void __rebuildFunctionGraph();
152 
155  public:
158  __varOrder.beginSafe();
159  varIter != __varOrder.endSafe();
160  ++varIter)
161  ret->add(**varIter);
162  }
163 
164  private:
166 
168 
170 
173 
176 
179  // double __pairSelectionThreshold;
180  };
181 
182 
183 } /* namespace gum */
184 
186 
187 #endif // GUM_IMDDI_H
Safe iterators for Sequence.
Definition: sequence.h:1203
void updateGraph()
Updates the tree after a new observation has been added.
Definition: imddi_tpl.h:119
LeafAggregator __lg
Definition: imddi.h:167
NodeId __insertLeafInFunctionGraph(AbstractLeaf *, Int2Type< true >)
Computes the score of the given variables for the given node.
Definition: imddi_tpl.h:388
void __removeLeaf(NodeId)
Adds a new observation to the structure.
Definition: imddi_tpl.h:301
Headers of the abstract Leaf class.
void addObservation(const Observation *)
Adds a new observation to the structure.
Definition: imddi_tpl.h:98
void _updateNodeWithObservation(const Observation *newObs, NodeId currentNodeId)
Adds a new observation to the structure.
Definition: imddi_tpl.h:105
Base class for discrete random variable.
void _removeNode(NodeId removedNodeId)
Adds a new observation to the structure.
Definition: imddi_tpl.h:275
void __updateScore(const DiscreteVariable *, NodeId, VariableSelector &vs)
Computes the score of the given variables for the given node.
Definition: imddi_tpl.h:169
<agrum/FMDP/learning/FunctionGraph/leafAggregator.h>
<agrum/FMDP/learning/datastructure/incrementalGraphLearner>
The generic class for storing (ordered) sequences of objects.
Definition: sequence.h:1019
void updateFunctionGraph()
Computes the score of the given variables for the given node.
Definition: imddi_tpl.h:313
<agrum/FMDP/learning/datastructure/leaves/abstractLeaf.h>
Definition: abstractLeaf.h:50
Base class for discrete random variable.
void __rebuildFunctionGraph()
Computes the score of the given variables for the given node.
Definition: imddi_tpl.h:325
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
HashTable< NodeId, AbstractLeaf *> __leafMap
Definition: imddi.h:169
The class for generic Hash Tables.
Definition: hashTable.h:676
Sequence< const DiscreteVariable *> __varOrder
Definition: imddi.h:165
void _chgNodeBoundVar(NodeId chgedNodeId, const DiscreteVariable *desiredVar)
Adds a new observation to the structure.
Definition: imddi_tpl.h:259
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:162
virtual void add(const DiscreteVariable &v)
Adds a new var to the variables of the multidimensional matrix.
Headers of the Concrete Leaf class.
~IMDDI()
Default destructor.
Definition: imddi_tpl.h:83
void __addLeaf(NodeId)
Adds a new observation to the structure.
Definition: imddi_tpl.h:287
void __downdateScore(const DiscreteVariable *, NodeId, VariableSelector &vs)
Computes the score of the given variables for the given node.
Definition: imddi_tpl.h:180
Headers of the Variable Selector class.
void insertSetOfVars(MultiDimFunctionGraph< double > *ret) const
Definition: imddi.h:156
Headers of MultiDimFunctionGraph.
IMDDI(MultiDimFunctionGraph< double > *target, double attributeSelectionThreshold, double pairSelectionThreshold, Set< const DiscreteVariable * > attributeListe, const DiscreteVariable *learnedValue)
Variable Learner constructor.
Definition: imddi_tpl.h:48
Headers of the interface specifying functions to be implemented by any incremental learner...
<agrum/FMDP/planning/FunctionGraph/variableselector.h>
double __attributeSelectionThreshold
The threshold above which we consider variables to be dependant.
Definition: imddi.h:175
Size Idx
Type for indexes.
Definition: types.h:50
NodeId _insertLeafNode(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar, Set< const Observation * > *sonsMap)
Adds a new observation to the structure.
Definition: imddi_tpl.h:241
Size NodeId
Type for node ids.
Definition: graphElements.h:97
Headers of the Leaf Aggregator class.
void __updateNodeSet(Set< NodeId > &, const DiscreteVariable *, VariableSelector &)
For each node in the given set, this methods checks whether or not we should installed the given vari...
Definition: imddi_tpl.h:198
<agrum/FMDP/learning/datastructure/nodeDatabase.h>
Definition: nodeDatabase.h:55
Idx __nbTotalObservation
The total number of observation added to this tree.
Definition: imddi.h:172