51#ifndef GUM_INCREMENTAL_GRAPH_LEARNER_H
52#define GUM_INCREMENTAL_GRAPH_LEARNER_H
82 template < TESTNAME AttributeSelection,
bool isScalar = false >
Headers of the Learning Strategy interface.
Base class for discrete random variable.
The class for generic Hash Tables.
<agrum/FMDP/SDyna/IVisitableGraphLearner.h>
const DiscreteVariable * nodeVar(NodeId ni) const
virtual void transpose_(NodeId, const DiscreteVariable *)
Installs given variable to the given node, ensuring that the variable is not present in its subtree.
virtual void updateVar(const DiscreteVariable *)
If a new modality appears to exists for given variable, call this method to turn every associated nod...
NodeId nodeSon(NodeId ni, Idx modality) const
virtual ~IncrementalGraphLearner()
Default destructor.
virtual NodeId insertLeafNode_(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar, Set< const Observation * > *obsSet)
inserts a new leaf node in internal graohs
bool isTerminal(NodeId ni) const
HashTable< const DiscreteVariable *, LinkedList< NodeId > * > var2Node_
Associates to any variable the list of all nodes associated to this variable.
NodeGraphPart model_
The source of nodeId.
Idx _branchObs_(const Observation *obs, const DiscreteVariable *var)
Seek modality assumed in obs for given var.
NodeId root_
The root of the ordered tree.
HashTable< NodeId, NodeId * > nodeSonsMap_
A table giving for any node a table mapping to its son idx is the modality of associated variable.
void _clearValue_(Int2Type< true >)
In the case where we're learning a function of real values this has to be wiped out upon destruction ...
HashTable< NodeId, NodeDatabase< AttributeSelection, isScalar > * > nodeId2Database_
This hashtable binds every node to an associated NodeDatabase which handles every observation that co...
Idx _branchObs_(const Observation *obs, const DiscreteVariable *var, Int2Type< true >)
Inserts a new observation.
const DiscreteVariable * value_
virtual void insertSetOfVars(MultiDimFunctionGraph< double > *ret) const
void _assumeValue_(const Observation *obs, Int2Type< true >)
Inserts a new observation.
virtual void addObservation(const Observation *obs)
Inserts a new observation.
typename ValueSelect< isScalar, double, Idx >::type ValueType
void updateNode_(NodeId nody, gum::VariableSet &bestVars)
From the given sets of node, selects randomly one and installs it on given node.
virtual void convertNode2Leaf_(NodeId)
Turns the given node into a leaf if not already so.
gum::VariableSet setOfVars_
virtual NodeId insertNode_(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar)
inserts a new node in internal graph
Sequence< ValueType > valueAssumed_
void _assumeValue_(const Observation *obs)
Get value assumed by studied variable for current observation.
virtual void updateNodeWithObservation_(const Observation *newObs, NodeId currentNodeId)
Will update internal graph's NodeDatabase of given node with the new observation.
Idx nodeNbObservation(NodeId ni) const
MultiDimFunctionGraph< double > * target_
The final diagram we're building.
void _assumeValue_(const Observation *obs, Int2Type< false >)
Inserts a new observation.
HashTable< NodeId, Set< const Observation * > * > leafDatabase_
This hashtable binds to every leaf an associated set of all hte observations compatible with it.
void _clearValue_()
Template function dispatcher.
virtual void updateFunctionGraph()=0
Updates target to currently learned graph structure.
HashTable< NodeId, const DiscreteVariable * > nodeVarMap_
Gives for any node its associated variable.
Idx _branchObs_(const Observation *obs, const DiscreteVariable *var, Int2Type< false >)
Inserts a new observation.
IncrementalGraphLearner(MultiDimFunctionGraph< double > *target, gum::VariableSet attributesSet, const DiscreteVariable *learnVariable)
Default constructor.
virtual void removeNode_(NodeId removedNodeId)
Removes a node from the internal graph.
virtual void chgNodeBoundVar_(NodeId chgedNodeId, const DiscreteVariable *desiredVar)
Changes the associated variable of a node.
virtual void updateGraph()=0
Updates the tree after a new observation has been added.
void _clearValue_(Int2Type< false >)
In case where we're learning function of variable behaviour, this should do nothing.
virtual NodeId insertInternalNode_(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar, NodeId *sonsMap)
inserts a new internal node in internal graph
virtual void add(const DiscreteVariable &v)
Adds a new var to the variables of the multidimensional matrix.
<agrum/FMDP/learning/datastructure/nodeDatabase.h>
Class for node sets in graph.
INLINE Idx modality(const DiscreteVariable *var) const
Returns the modality assumed by the given variable in this observation.
INLINE Idx rModality(const DiscreteVariable *var) const
Returns the modality assumed by the given variable in this observation.
double reward() const
Returns the modality assumed by the given variable in this observation.
Safe iterators for the Set class.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
Size NodeId
Type for node ids.
gum is the global namespace for all aGrUM entities
Set< const DiscreteVariable * > VariableSet
Headers of the NodeDatabase class.