![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
Learn a graphical representation of a function as a decision tree. More...
#include <agrum/FMDP/planning/FunctionGraph/iti.h>
Public Member Functions | |
Size | size () |
Constructor & destructor. | |
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 variable such as conditionnal probabilities. More... | |
ITI (MultiDimFunctionGraph< double > *target, double attributeSelectionThreshold, Set< const DiscreteVariable * > attributeListe) | |
ITI constructeur for real functions. More... | |
~ITI () | |
Default destructor. More... | |
Visit Methods | |
NodeId | root () const |
bool | isTerminal (NodeId ni) const |
const DiscreteVariable * | nodeVar (NodeId ni) const |
NodeId | nodeSon (NodeId ni, Idx modality) const |
Idx | nodeNbObservation (NodeId ni) const |
virtual void | insertSetOfVars (MultiDimFunctionGraph< double > *ret) const |
Protected Attributes | |
MultiDimFunctionGraph< double > * | target_ |
The final diagram we're building. More... | |
Set< const DiscreteVariable *> | setOfVars_ |
const DiscreteVariable * | value_ |
Sequence< ValueType > | valueAssumed_ |
bool | needUpdate_ |
Model handling datastructures | |
NodeGraphPart | model_ |
The source of nodeId. More... | |
NodeId | root_ |
The root of the ordered tree. More... | |
HashTable< NodeId, const DiscreteVariable *> | nodeVarMap_ |
Gives for any node its associated variable. More... | |
HashTable< NodeId, NodeId *> | nodeSonsMap_ |
A table giving for any node a table mapping to its son idx is the modality of associated variable. More... | |
HashTable< const DiscreteVariable *, LinkedList< NodeId > *> | var2Node_ |
Associates to any variable the list of all nodes associated to this variable. More... | |
HashTable< NodeId, NodeDatabase< AttributeSelection, isScalar > *> | nodeId2Database_ |
This hashtable binds every node to an associated NodeDatabase which handles every observation that concerns that node. More... | |
HashTable< NodeId, Set< const Observation *> *> | leafDatabase_ |
This hashtable binds to every leaf an associated set of all hte observations compatible with it. More... | |
Protected Member Functions | |
void | insertSetOfVars_ (MultiDimFunctionGraph< double > *ret) |
insertSetOfVars_ More... | |
Graph Structure update methods | |
virtual void | updateVar (const DiscreteVariable *) |
If a new modality appears to exists for given variable, call this method to turn every associated node to this variable into leaf. Graph has then indeed to be revised. More... | |
void | updateNode_ (NodeId nody, Set< const DiscreteVariable * > &bestVars) |
From the given sets of node, selects randomly one and installs it on given node. More... | |
virtual void | convertNode2Leaf_ (NodeId) |
Turns the given node into a leaf if not already so. More... | |
virtual void | transpose_ (NodeId, const DiscreteVariable *) |
Installs given variable to the given node, ensuring that the variable is not present in its subtree. More... | |
virtual NodeId | insertInternalNode_ (NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar, NodeId *sonsMap) |
inserts a new internal node in internal graph More... | |
virtual NodeId | insertLeafNode_ (NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar, Set< const Observation * > *obsSet) |
inserts a new leaf node in internal graohs More... | |
New Observation insertion methods | |
void | addObservation (const Observation *obs) |
Inserts a new observation. More... | |
void | updateNodeWithObservation_ (const Observation *newObs, NodeId currentNodeId) |
Will update internal graph's NodeDatabase of given node with the new observation. More... | |
Graph Structure update methods | |
void | updateGraph () |
Updates the internal graph after a new observation has been added. More... | |
NodeId | insertNode_ (NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar) |
inserts a new node in internal graph More... | |
void | chgNodeBoundVar_ (NodeId chgedNodeId, const DiscreteVariable *desiredVar) |
Changes the associated variable of a node. More... | |
void | removeNode_ (NodeId removedNodeId) |
Removes a node from the internal graph. More... | |
Function Graph Updating methods | |
void | updateFunctionGraph () |
Updates target to currently learned graph structure. More... | |
NodeId | _insertNodeInFunctionGraph_ (NodeId src) |
Inserts an internal node in the target. More... | |
NodeId | _insertTerminalNode_ (NodeId src) |
Insert a terminal node in the target. More... | |
NodeId | _insertTerminalNode_ (NodeId src, Int2Type< true >) |
Insert a terminal node in the target. More... | |
NodeId | _insertTerminalNode_ (NodeId src, Int2Type< false >) |
Insert a terminal node in the target. More... | |
Learn a graphical representation of a function as a decision tree.
This learning is done incrementaly. Hence first observation are add to the structure and then the structure is updated. Maintains two graph function : one internal for the learning and a target which is updated on demand.
gum::ITI< AttributeSelection, isScalar >::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 variable such as conditionnal probabilities.
target | : the MultiDimFunctionGraph in which we load the structure |
attributeSelectionThreshold | : threshold under which a node is not installed (pe-pruning) |
attributeListe | : Set of vars on which we rely to explain the behaviour of learned variable |
learnedValue | : the variable from which we try to learn the behaviour |
target | : the MultiDimFunctionGraph in which we load the structure |
attributeSelectionThreshold | : threshold under which a node is not installed (pe-pruning) |
temporaryAPIfix | : Issue in API in regard to IMDDI |
attributeListe | : Set of vars on which we rely to explain the behaviour of learned variable |
learnedValue | : the variable from which we try to learn the behaviour |
Definition at line 61 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
gum::ITI< AttributeSelection, isScalar >::ITI | ( | MultiDimFunctionGraph< double > * | target, |
double | attributeSelectionThreshold, | ||
Set< const DiscreteVariable * > | attributeListe | ||
) |
ITI constructeur for real functions.
We try to predict the output of a function f given a set of variable
target | : the MultiDimFunctionGraph in which we load the structure |
attributeSelectionThreshold | : threshold under which a node is not installed (pe-pruning) |
attributeListe | : Set of vars on which we rely to explain the behaviour of learned function |
We try to predict the output of a function f given a set of variable
target | : the MultiDimFunctionGraph in which we load the structure |
attributeSelectionThreshold | : threshold under which a node is not installed (pe-pruning) |
temporaryAPIfix | : Issue in API in regard to IMDDI |
attributeListeSet | of vars on which we rely to explain the behaviour of learned function |
Definition at line 84 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inline |
Default destructor.
Definition at line 104 of file iti.h.
|
private |
Inserts an internal node in the target.
src | the source node in internal graph |
the | source node in internal graph |
Definition at line 265 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlineprivate |
Insert a terminal node in the target.
This function is a dispatcher that will call the right function according to the value of the template isScalar
src | the source node in the learned graph |
Definition at line 209 of file iti.h.
|
private |
Insert a terminal node in the target.
This function is called if we're learning a real value function. Inserts then a single value in target.
src | the source node in the learned graph |
This function is called if we're learning the behaviour of a variable. Inserts then this variable and the relevant value beneath into target.
the | source node in the learned graph |
Definition at line 325 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
private |
Insert a terminal node in the target.
This function is called if we're learning the behaviour of a variable. Inserts then this variable and the relevant value beneath into target.
src | the source node in the learned graph |
This function is called if we're learning a real value function. Inserts then a single value in target.
the | source node in the learned graph |
Definition at line 295 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Inserts a new observation.
obs | the new observation to learn |
the | new observation to learn |
Reimplemented from gum::IncrementalGraphLearner< AttributeSelection, isScalar >.
Definition at line 108 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtual |
Changes the associated variable of a node.
chgedNodeId | : the node to change |
desiredVar | : its new associated variable |
Reimplemented from gum::IncrementalGraphLearner< AttributeSelection, isScalar >.
Definition at line 220 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
Turns the given node into a leaf if not already so.
Definition at line 200 of file incrementalGraphLearner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
inserts a new internal node in internal graph
nDB | : the associated database |
boundVar | : the associated variable |
sonsMap | : a table giving node's sons node |
Definition at line 362 of file incrementalGraphLearner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtualinherited |
inserts a new leaf node in internal graohs
nDB | : the associated database |
boundVar | : the associated variable |
obsSet | : the set of observation this leaf retains |
Reimplemented in gum::IMDDI< AttributeSelection, isScalar >.
Definition at line 382 of file incrementalGraphLearner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtual |
inserts a new node in internal graph
inserts a new node in internal graohs
nDB | : the associated database |
boundVar | : the associated variable |
Reimplemented from gum::IncrementalGraphLearner< AttributeSelection, isScalar >.
Definition at line 203 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlinevirtualinherited |
Implements gum::IVisitableGraphLearner.
Reimplemented in gum::IMDDI< AttributeSelection, isScalar >.
Definition at line 326 of file incrementalGraphLearner.h.
|
inlineprotected |
insertSetOfVars_
ret |
Definition at line 245 of file iti.h.
|
inlinevirtualinherited |
Implements gum::IVisitableGraphLearner.
Definition at line 306 of file incrementalGraphLearner.h.
|
inlinevirtualinherited |
Implements gum::IVisitableGraphLearner.
Definition at line 321 of file incrementalGraphLearner.h.
|
inlinevirtualinherited |
Implements gum::IVisitableGraphLearner.
Definition at line 316 of file incrementalGraphLearner.h.
|
inlinevirtualinherited |
Implements gum::IVisitableGraphLearner.
Definition at line 311 of file incrementalGraphLearner.h.
|
protectedvirtual |
Removes a node from the internal graph.
removedNodeId | : the node to remove |
Reimplemented from gum::IncrementalGraphLearner< AttributeSelection, isScalar >.
Definition at line 237 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
inlinevirtualinherited |
Implements gum::IVisitableGraphLearner.
Definition at line 301 of file incrementalGraphLearner.h.
|
inlineinherited |
Definition at line 290 of file incrementalGraphLearner.h.
|
protectedvirtualinherited |
Installs given variable to the given node, ensuring that the variable is not present in its subtree.
Definition at line 227 of file incrementalGraphLearner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Updates target to currently learned graph structure.
Implements gum::IncrementalGraphLearner< AttributeSelection, isScalar >.
Definition at line 251 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtual |
Updates the internal graph after a new observation has been added.
Implements gum::IncrementalGraphLearner< AttributeSelection, isScalar >.
Definition at line 139 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedinherited |
From the given sets of node, selects randomly one and installs it on given node.
Chechks of course if node's current variable is not in that set first.
nody | : the node we update |
bestVars | : the set of interessting vars to be installed here |
Chechks of course if node's current variable is not in that set first.
nody | : the node we update |
bestVar | : the set of interessting vars to be installed here |
Definition at line 169 of file incrementalGraphLearner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedvirtual |
Will update internal graph's NodeDatabase of given node with the new observation.
newObs | |
currentNodeId |
Reimplemented from gum::IncrementalGraphLearner< AttributeSelection, isScalar >.
Definition at line 122 of file iti_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
virtualinherited |
If a new modality appears to exists for given variable, call this method to turn every associated node to this variable into leaf. Graph has then indeed to be revised.
Definition at line 147 of file incrementalGraphLearner_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protectedinherited |
This hashtable binds to every leaf an associated set of all hte observations compatible with it.
Definition at line 379 of file incrementalGraphLearner.h.
|
protectedinherited |
The source of nodeId.
Definition at line 345 of file incrementalGraphLearner.h.
|
protectedinherited |
Definition at line 392 of file incrementalGraphLearner.h.
|
protectedinherited |
This hashtable binds every node to an associated NodeDatabase which handles every observation that concerns that node.
Definition at line 373 of file incrementalGraphLearner.h.
|
protectedinherited |
A table giving for any node a table mapping to its son idx is the modality of associated variable.
Definition at line 361 of file incrementalGraphLearner.h.
|
protectedinherited |
Gives for any node its associated variable.
Definition at line 355 of file incrementalGraphLearner.h.
|
protectedinherited |
The root of the ordered tree.
Definition at line 350 of file incrementalGraphLearner.h.
|
protectedinherited |
Definition at line 387 of file incrementalGraphLearner.h.
|
protectedinherited |
The final diagram we're building.
Definition at line 385 of file incrementalGraphLearner.h.
|
protectedinherited |
Definition at line 389 of file incrementalGraphLearner.h.
|
protectedinherited |
Definition at line 390 of file incrementalGraphLearner.h.
|
protectedinherited |
Associates to any variable the list of all nodes associated to this variable.
Definition at line 367 of file incrementalGraphLearner.h.