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>
virtual void updateNodeWithObservation_(const Observation *newObs, NodeId currentNodeId)
Will update internal graph's NodeDatabase of given node with the new observation.
NodeId nodeSon(NodeId ni, Idx modality) const override
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...
virtual NodeId insertLeafNode_(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar, Set< const Observation * > *obsSet)
inserts a new leaf node in internal graohs
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.
HashTable< NodeId, NodeDatabase< AttributeSelection, isScalar > * > nodeId2Database_
This hashtable binds every node to an associated NodeDatabase which handles every observation that co...
const DiscreteVariable * value_
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.
const DiscreteVariable * nodeVar(NodeId ni) const override
MultiDimFunctionGraph< double > * target_
The final diagram we're building.
~IncrementalGraphLearner() override
Default destructor.
HashTable< NodeId, Set< const Observation * > * > leafDatabase_
This hashtable binds to every leaf an associated set of all hte observations compatible with it.
Idx nodeNbObservation(NodeId ni) const override
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.
NodeId root() const override
void insertSetOfVars(MultiDimFunctionGraph< double > *ret) const override
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.
bool isTerminal(NodeId ni) const override
virtual void updateGraph()=0
Updates the tree after a new observation has been added.
virtual NodeId insertInternalNode_(NodeDatabase< AttributeSelection, isScalar > *nDB, const DiscreteVariable *boundVar, NodeId *sonsMap)
inserts a new internal node in internal graph
<agrum/FMDP/learning/datastructure/nodeDatabase.h>
Class for node sets in graph.
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.