32 #ifndef GUM_INCREMENTAL_GRAPH_LEARNER_H 33 #define GUM_INCREMENTAL_GRAPH_LEARNER_H 65 template < TESTNAME AttributeSelection,
bool isScalar = false >
420 #endif // GUM_INCREMENTAL_GRAPH_LEARNER_H void __assumeValue(const Observation *obs)
Get value assumed by studied variable for current observation.
virtual void updateFunctionGraph()=0
Updates target to currently learned graph structure.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void _updateNodeWithObservation(const Observation *newObs, NodeId currentNodeId)
Will update internal graph's NodeDatabase of given node with the new observation. ...
HashTable< NodeId, NodeId *> _nodeSonsMap
A table giving for any node a table mapping to its son idx is the modality of associated variable...
Idx nodeNbObservation(NodeId ni) const
HashTable< const DiscreteVariable *, LinkedList< NodeId > *> _var2Node
Associates to any variable the list of all nodes associated to this variable.
IncrementalGraphLearner(MultiDimFunctionGraph< double > *target, Set< const DiscreteVariable * > attributesSet, const DiscreteVariable *learnVariable)
Default constructor.
Set< const DiscreteVariable *> _setOfVars
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
HashTable< NodeId, NodeDatabase< AttributeSelection, isScalar > *> _nodeId2Database
This hashtable binds every node to an associated NodeDatabase which handles every observation that co...
void _updateNode(NodeId nody, Set< const DiscreteVariable * > &bestVars)
From the given sets of node, selects randomly one and installs it on given node.
Safe iterators for the Set classDevelopers may consider using Set<x>::iterator_safe instead of SetIte...
virtual NodeId _insertInternalNode(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar, NodeId *sonsMap)
inserts a new internal node in internal graph
Idx __branchObs(const Observation *obs, const DiscreteVariable *var)
Seek modality assumed in obs for given var.
<agrum/FMDP/learning/datastructure/incrementalGraphLearner>
virtual ~IncrementalGraphLearner()
Default destructor.
virtual NodeId _insertNode(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar)
inserts a new node in internal graph
The generic class for storing (ordered) sequences of objects.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
virtual void _convertNode2Leaf(NodeId)
Turns the given node into a leaf if not already so.
<agrum/FMDP/SDyna/IVisitableGraphLearner.h>
bool exists(const Key &key) const
Checks whether there exists an element with a given key in the hashtable.
Base class for discrete random variable.
void __clearValue()
Template function dispatcher.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
MultiDimFunctionGraph< double > * _target
The final diagram we're building.
void __clearValue(Int2Type< false >)
In case where we're learning function of variable behaviour, this should do nothing.
Idx __branchObs(const Observation *obs, const DiscreteVariable *var, Int2Type< false >)
Inserts a new observation.
void __assumeValue(const Observation *obs, Int2Type< true >)
Inserts a new observation.
virtual NodeId _insertLeafNode(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar, Set< const Observation * > *obsSet)
inserts a new leaf node in internal graohs
The class for generic Hash Tables.
Representation of a setA Set is a structure that contains arbitrary elements.
virtual void add(const DiscreteVariable &v)
Adds a new var to the variables of the multidimensional matrix.
virtual void addObservation(const Observation *obs)
Inserts a new observation.
const DiscreteVariable * _value
HashTable< NodeId, Set< const Observation *> *> _leafDatabase
This hashtable binds to every leaf an associated set of all hte observations compatible with it...
Idx __branchObs(const Observation *obs, const DiscreteVariable *var, Int2Type< true >)
Inserts a new observation.
virtual void _transpose(NodeId, const DiscreteVariable *)
Installs given variable to the given node, ensuring that the variable is not present in its subtree...
double reward() const
Returns the modality assumed by the given variable in this observation.
virtual void updateGraph()=0
Updates the tree after a new observation has been added.
virtual void _removeNode(NodeId removedNodeId)
Removes a node from the internal graph.
Sequence< ValueType > _valueAssumed
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
INLINE Idx rModality(const DiscreteVariable *var) const
Returns the modality assumed by the given variable in this observation.
Class for node sets in graph.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
INLINE Idx modality(const DiscreteVariable *var) const
Returns the modality assumed by the given variable in this observation.
void __clearValue(Int2Type< true >)
In the case where we're learning a function of real values this has to be wiped out upon destruction ...
const DiscreteVariable * nodeVar(NodeId ni) const
virtual void insertSetOfVars(MultiDimFunctionGraph< double > *ret) const
virtual void _chgNodeBoundVar(NodeId chgedNodeId, const DiscreteVariable *desiredVar)
Changes the associated variable of a node.
void __assumeValue(const Observation *obs, Int2Type< false >)
Inserts a new observation.
NodeId _root
The root of the ordered tree.
NodeId nodeSon(NodeId ni, Idx modality) const
Size Idx
Type for indexes.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool isTerminal(NodeId ni) const
virtual void updateVar(const DiscreteVariable *)
If a new modality appears to exists for given variable, call this method to turn every associated nod...
std::size_t Size
In aGrUM, hashed values are unsigned long int.
NodeGraphPart _model
The source of nodeId.
HashTable< NodeId, const DiscreteVariable *> _nodeVarMap
Gives for any node its associated variable.
Size NodeId
Type for node ids.
ValueSelect< isScalar, double, Idx >::type ValueType
<agrum/FMDP/learning/datastructure/nodeDatabase.h>