29 #ifndef GUM_LEARNING_GRAPH_CHANGES_SELECTOR_4_DIGRAPH_H 30 #define GUM_LEARNING_GRAPH_CHANGES_SELECTOR_4_DIGRAPH_H 51 template <
typename STRUCTURAL_CONSTRAINT,
52 typename GRAPH_CHANGES_GENERATOR,
53 template <
typename >
class ALLOC = std::allocator >
66 STRUCTURAL_CONSTRAINT& constraint,
67 GRAPH_CHANGES_GENERATOR& changes_generator);
72 GRAPH_CHANGES_GENERATOR,
78 GRAPH_CHANGES_GENERATOR,
93 GRAPH_CHANGES_GENERATOR,
96 GRAPH_CHANGES_GENERATOR,
101 GRAPH_CHANGES_GENERATOR,
104 GRAPH_CHANGES_GENERATOR,
123 bool empty(const
NodeId i);
147 double bestScore(const
NodeId i);
237 const NodeId target_node);
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
NodeProperty< double > __node_current_scores
the current score of each node
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool empty()
indicates whether the selector still contains graph changes
The base class for all the scores used for learning (BIC, BDeu, etc)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
GeneratorType & graphChangeGenerator() const noexcept
returns the generator used by the selector
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void __updateScores(const Set< std::size_t > &changes_to_recompute)
perform the necessary updates of the scores
STRUCTURAL_CONSTRAINT * __constraint
the set of constraints used to determine valid changes
The generic class for storing (ordered) sequences of objects.
GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > & operator=(const GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > &from)
copy operator
const GraphChange & bestChange()
returns the best graph change to examine
void applyChange(const GraphChange &change)
indicate to the selector that a change has been applied
Set< std::size_t > __illegal_changes
the set of changes known to be currently illegal (due to the constraints)
Score< ALLOC > * __score
the scoring function
~GraphChangesSelector4DiGraph()
destructor
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
PriorityQueue< NodeId, double, std::greater< double > > __node_queue
a global priority queue indicating for each node its best score
The class for generic Hash Tables.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::vector< std::pair< double, double > > __change_scores
the scores for the head and tail of all the changes
Representation of a setA Set is a structure that contains arbitrary elements.
The mecanism to compute the next available graph changes for directed structure learning search algor...
void applyChangeWithoutScoreUpdate(const GraphChange &change)
indicate to the selector that one of serveral changes has been applied
A priorityQueue is a heap in which each element has a mutable priorityA priority queue is quite simil...
bool __isChangeValid(const std::size_t index) const
indicates whether a given change is valid or not
NodeProperty< std::vector< NodeId, ALLOC< NodeId > > > __parents
the set of parents of each node (speeds-up score computations)
Base class for all oriented graphs.
Set< NodeId > __queues_to_update
the set of queues to update when applying several changes
double bestScore()
return the score of the best graph change
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
bool __queues_valid
indicates whether we need to recompute whether the queue is empty or not
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
GraphChangesSelector4DiGraph(Score< ALLOC > &score, STRUCTURAL_CONSTRAINT &constraint, GRAPH_CHANGES_GENERATOR &changes_generator)
default constructor
void updateScoresAfterAppliedChanges()
recompute all the scores after the application of several changes
std::vector< std::pair< NodeId, double > > nodesUnsortedWithScore() const
returns the set of queues top priorities
Sequence< GraphChange > __changes
a sequence containing all the possible changes
std::vector< std::pair< NodeId, double > > nodesSortedByBestScore() const
returns the set of queues sorted by decreasing top priority
void __invalidateChange(const std::size_t change_index)
put a change into the illegal set
void __findLegalChangesNeedingUpdate(Set< std::size_t > &changes_to_recompute, const NodeId target_node)
finds the changes that are affected by a given node modification
void __illegal2LegalChanges(Set< std::size_t > &changes_to_recompute)
remove the now legal changes from the illegal set
void setGraph(DiGraph &graph)
sets the graph from which scores are computed
GRAPH_CHANGES_GENERATOR GeneratorType
the type of the generator
GRAPH_CHANGES_GENERATOR * __changes_generator
the generator that returns the set of possible changes
void __getNewChanges()
get from the graph change generator a new set of changes
bool isChangeValid(const GraphChange &change) const
indicates whether a given change is valid or not
Size NodeId
Type for node ids.
NodeProperty< PriorityQueue< std::size_t, double, std::greater< double > > > __change_queue_per_node
for each node, a priority queue sorting GraphChanges by decreasing score