![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
The mecanism to compute the next available graph changes for directed structure learning search algorithms. More...
#include <graphChangesSelector4DiGraph.h>
Public Member Functions | |
Constructors / Destructors | |
GraphChangesSelector4DiGraph (Score< ALLOC > &score, STRUCTURAL_CONSTRAINT &constraint, GRAPH_CHANGES_GENERATOR &changes_generator) | |
default constructor More... | |
GraphChangesSelector4DiGraph (const GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > &from) | |
copy constructor More... | |
GraphChangesSelector4DiGraph (GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > &&from) | |
move constructor More... | |
~GraphChangesSelector4DiGraph () | |
destructor More... | |
Operators | |
GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > & | operator= (const GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > &from) |
copy operator More... | |
GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > & | operator= (GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > &&from) |
move operator More... | |
Accessors / Modifiers | |
GeneratorType & | graphChangeGenerator () const noexcept |
returns the generator used by the selector More... | |
bool | empty () |
indicates whether the selector still contains graph changes More... | |
bool | empty (const NodeId i) |
indicates whether the selector contains graph changes related to the ith node More... | |
const GraphChange & | bestChange () |
returns the best graph change to examine More... | |
const GraphChange & | bestChange (const NodeId i) |
returns the best graph change to examine related to the ith node More... | |
double | bestScore () |
return the score of the best graph change More... | |
double | bestScore (const NodeId i) |
return the score of the best graph change related to the ith node More... | |
void | applyChange (const GraphChange &change) |
indicate to the selector that a change has been applied More... | |
void | applyChangeWithoutScoreUpdate (const GraphChange &change) |
indicate to the selector that one of serveral changes has been applied More... | |
void | updateScoresAfterAppliedChanges () |
recompute all the scores after the application of several changes More... | |
bool | isChangeValid (const GraphChange &change) const |
indicates whether a given change is valid or not More... | |
void | setGraph (DiGraph &graph) |
sets the graph from which scores are computed More... | |
std::vector< std::pair< NodeId, double > > | nodesSortedByBestScore () const |
returns the set of queues sorted by decreasing top priority More... | |
std::vector< std::pair< NodeId, double > > | nodesUnsortedWithScore () const |
returns the set of queues top priorities More... | |
Public Types | |
using | GeneratorType = GRAPH_CHANGES_GENERATOR |
the type of the generator More... | |
The mecanism to compute the next available graph changes for directed structure learning search algorithms.
Definition at line 53 of file graphChangesSelector4DiGraph.h.
using gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::GeneratorType = GRAPH_CHANGES_GENERATOR |
the type of the generator
Definition at line 56 of file graphChangesSelector4DiGraph.h.
gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::GraphChangesSelector4DiGraph | ( | Score< ALLOC > & | score, |
STRUCTURAL_CONSTRAINT & | constraint, | ||
GRAPH_CHANGES_GENERATOR & | changes_generator | ||
) |
default constructor
gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::GraphChangesSelector4DiGraph | ( | const GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > & | from | ) |
copy constructor
gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::GraphChangesSelector4DiGraph | ( | GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > && | from | ) |
move constructor
gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::~GraphChangesSelector4DiGraph | ( | ) |
destructor
|
private |
finds the changes that are affected by a given node modification
|
private |
get from the graph change generator a new set of changes
|
private |
remove the now legal changes from the illegal set
|
private |
put a change into the illegal set
|
private |
indicates whether a given change is valid or not
|
private |
perform the necessary updates of the scores
void gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::applyChange | ( | const GraphChange & | change | ) |
indicate to the selector that a change has been applied
void gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::applyChangeWithoutScoreUpdate | ( | const GraphChange & | change | ) |
indicate to the selector that one of serveral changes has been applied
This function is to be used rather than applyChange when we wish to apply several changes at a time. It is faster than applyChange because it does not recomputes the scores. Then, after applying all changes, we shall compute the scores with function updateScoresAfterAppliedChanges (). See class GreedyHillClimbing for an illustration of the use of this method.
const GraphChange& gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::bestChange | ( | ) |
returns the best graph change to examine
NotFound | exception is thrown if the selector is empty |
const GraphChange& gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::bestChange | ( | const NodeId | i | ) |
returns the best graph change to examine related to the ith node
The selector computes not only the best change possible but also the best changes impacting the parents' set of each node. This method allows to get the change that is considered the best for modifying the parents' set of the ith node.
NotFound | exception is thrown if the selector is empty |
double gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::bestScore | ( | ) |
return the score of the best graph change
NotFound | exception is thrown if the selector is empty |
double gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::bestScore | ( | const NodeId | i | ) |
return the score of the best graph change related to the ith node
The selector computes not only the best change possible but also the best changes impacting the parents' set of each node. This method allows to get the score of the change that is considered the best for modifying the parents' set of the ith node.
NotFound | exception is thrown if the selector is empty |
bool gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::empty | ( | ) |
indicates whether the selector still contains graph changes
bool gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::empty | ( | const NodeId | i | ) |
indicates whether the selector contains graph changes related to the ith node
|
noexcept |
returns the generator used by the selector
bool gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::isChangeValid | ( | const GraphChange & | change | ) | const |
indicates whether a given change is valid or not
std::vector< std::pair< NodeId, double > > gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::nodesSortedByBestScore | ( | ) | const |
returns the set of queues sorted by decreasing top priority
std::vector< std::pair< NodeId, double > > gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::nodesUnsortedWithScore | ( | ) | const |
returns the set of queues top priorities
GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >& gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::operator= | ( | const GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > & | from | ) |
copy operator
GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >& gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::operator= | ( | GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC > && | from | ) |
move operator
void gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::setGraph | ( | DiGraph & | graph | ) |
sets the graph from which scores are computed
void gum::learning::GraphChangesSelector4DiGraph< STRUCTURAL_CONSTRAINT, GRAPH_CHANGES_GENERATOR, ALLOC >::updateScoresAfterAppliedChanges | ( | ) |
recompute all the scores after the application of several changes
This method needs COMPULSORILY be used after applications of applyChangeWithoutScoreUpdate in order to ensure the fact that functions bestScore and bestChange return correct answers. See class GreedyHillClimbing for an illustration of the use of this method.
|
private |
for each node, a priority queue sorting GraphChanges by decreasing score
within each queue, the changes are determined by their index in sequence changes.
Definition at line 196 of file graphChangesSelector4DiGraph.h.
|
private |
the scores for the head and tail of all the changes
the scores are indexed by their index in sequence changes
Definition at line 190 of file graphChangesSelector4DiGraph.h.
|
private |
a sequence containing all the possible changes
Definition at line 186 of file graphChangesSelector4DiGraph.h.
|
private |
the generator that returns the set of possible changes
Definition at line 183 of file graphChangesSelector4DiGraph.h.
|
private |
the set of constraints used to determine valid changes
Definition at line 180 of file graphChangesSelector4DiGraph.h.
|
private |
the set of changes known to be currently illegal (due to the constraints)
within each queue, the changes are determined by their index in sequence changes.
Definition at line 204 of file graphChangesSelector4DiGraph.h.
|
private |
the current score of each node
Definition at line 207 of file graphChangesSelector4DiGraph.h.
|
private |
a global priority queue indicating for each node its best score
Definition at line 199 of file graphChangesSelector4DiGraph.h.
|
private |
the set of parents of each node (speeds-up score computations)
Definition at line 210 of file graphChangesSelector4DiGraph.h.
|
private |
the set of queues to update when applying several changes
Definition at line 216 of file graphChangesSelector4DiGraph.h.
|
private |
indicates whether we need to recompute whether the queue is empty or not
Definition at line 213 of file graphChangesSelector4DiGraph.h.
|
private |
the scoring function
Definition at line 177 of file graphChangesSelector4DiGraph.h.