aGrUM 3.1.1
a C++ library for (probabilistic) graphical models
gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > Class Template Reference

The mecanism to compute the next available graph changes for directed structure learning search algorithms. More...

#include <graphChangesSelector4DiGraph.h>

Collaboration diagram for gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >:

Public Member Functions

Constructors / Destructors
 GraphChangesSelector4DiGraph (Score &score, INVARIABLE_CONSTRAINT_TYPE &invariable_constraints, VARIABLE_CONSTRAINT_TYPE &variable_constraints)
 default constructor
 GraphChangesSelector4DiGraph (const GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > &from)
 copy constructor
 GraphChangesSelector4DiGraph (GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > &&from)
 move constructor
 ~GraphChangesSelector4DiGraph ()
 destructor
Operators
GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > & operator= (const GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > &from)
 copy operator
GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > & operator= (GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > &&from)
 move operator
Accessors / Modifiers
const GraphChangebestChange ()
 returns the best graph change to examine
double bestDeltaScore ()
 return the score of the best graph change
double deltaScore (const GraphChange &change, const bool internal_change=false) const
 return the score of a given change
double score (const NodeId node) const
 returns the current score of a node
void applyChange (const GraphChange &change)
 indicate to the selector that a change has been applied
bool isChangeValid (const GraphChange &change) const
 indicates whether a given change is valid or not
void setGraph (DiGraph &graph)
 sets the graph from which scores are computed
void finalizeGraph (DiGraph &graph)
 adds some nodes that were removed because they did not belong to the database
void useArcAdditions (bool use)
 sets whether or not the selector allows the application of arc additions
void useArcDeletions (bool use)
 sets whether or not the selector allows the application of arc deletions
void useArcReversals (bool use)
 sets whether or not the selector allows the application of arc reversals
void useArcTriangleDeletions (bool use)
 sets whether or not the selector allows the application of arc triangle deletions
bool arcAdditionsEnabled () const
 indicates whether the selector allows the application of arc additions
bool arcDeletionsEnabled () const
 indicates whether the selector allows the application of arc deletions
bool arcReversalsEnabled () const
 indicates whether the selector allows the application of arc reversals
bool arcTriangleDeletionsEnabled () const
 indicates whether the selector allows the application of arc triangle deletions
INVARIABLE_CONSTRAINT_TYPE & invariableConstraints ()
 returns the set of invariable constraints used by the selector
VARIABLE_CONSTRAINT_TYPE & variableConstraints ()
 returns the set of variable constraints used by the selector

Private Member Functions

double _scoreAfterAddingParent_ (const NodeId node, const NodeId new_parent)
 computes the new score of node given that we added it a new parent
double _scoreAfterAddingParents_ (const NodeId node, const NodeId new_parent1, const NodeId new_parent2)
 computes the new score of node given that we added it two new parents
double _scoreAfterRemovingParent_ (const NodeId node, const NodeId parent)
 computes the new score of node given that we removed a parent
double _scoreAfterRemovingParents_ (const NodeId node, const NodeId parent1, const NodeId parent2)
 computes the new score of node given that we removed two parents
void _addArcAdditionToSortedChanges_ (const ArcAddition &change)
 adds an ArcAddition to sorted_changes if possible
void _addArcDeletionToSortedChanges_ (const ArcDeletion &change)
 adds an ArcDeletion to sorted_changes if possible
void _addArcReversalToSortedChanges_ (const ArcReversal &change)
 adds an ArcReversal to sorted_changes if possible
void _addArcTriangleDeletion1ToSortedChanges_ (const ArcTriangleDeletion1 &change)
 adds an ArcTriangleDeletion1 to sorted_changes if possible
void _addArcTriangleDeletion2ToSortedChanges_ (const ArcTriangleDeletion2 &change)
 adds an ArcTriangleDeletion2 to sorted_changes if possible
void _updateArcAdditionScore_ (const NodeId tail, const NodeId head)
 updates the score of a given ArcAddition
void _updateArcDeletionScore_ (const NodeId tail, const NodeId head)
 updates the score of a given ArcDeletion
void _updateArcReversalScore_ (const NodeId tail, const NodeId head)
 updates the score of a given ArcReversal
void _updateTriangleDeletionsScoresFromNeighborhood_ (const NodeId changed_node)
 update the score of the triangle deletions which contain a node whose neighborhood has changed
void _initSortedChangesWithArcAdditions_ (const DiGraph &graph)
 add all the possible ArcAdditions to initialize sorted_changes
void _initSortedChangesWithArcDeletions_ (const DiGraph &graph)
 add all the possible ArcDeletions to initialize sorted_changes
void _initSortedChangesWithArcReversals_ (const DiGraph &graph)
 add all the possible ArcReversals to initialize sorted_changes
void _initSortedChangesWithArcTriangleDeletions_ (const DiGraph &graph)
 add all the possible ArcTriangleDeletions to initialize sorted_changes
void _applyArcAddition_ (const ArcAddition &change, bool update_contraints)
 indicate to the selector that an ArcAddition has been applied
void _applyArcDeletion_ (const ArcDeletion &change, bool update_contraints)
 indicate to the selector that an ArcDeletion has been applied
void _applyArcReversal_ (const ArcReversal &change, bool update_contraints)
 indicate to the selector that an ArcReversal has been applied
void _applyArcTriangleDeletion1_ (const ArcTriangleDeletion1 &change, bool update_contraints)
 indicate to the selector that an ArcTriangleDeletion1 has been applied
void _applyArcTriangleDeletion2_ (const ArcTriangleDeletion2 &change, bool update_contraints)
 indicate to the selector that an ArcTriangleDeletion2 has been applied

Private Attributes

Score_score_
 the scoring function
INVARIABLE_CONSTRAINT_TYPE * _invariable_constraints_
 the set of constraints which, for a given change, always return the same output
VARIABLE_CONSTRAINT_TYPE * _variable_constraints_
 the set of constraints whose outputs can change depending on the current graph
DiGraph_graph_ {nullptr}
 the graph that we learn
NodeProperty< double_node_scores_
 the current score of each node
NodeProperty< std::vector< NodeId > > _node_parents_
 the set of parents of each node (speeds-up score computations)
SortedPriorityQueue< GraphChange, double_sorted_changes_
 the graph changes sorted by decreasing delta score value
NodeSet _removed_nodes_
 the set of nodes removed from the graph passed in argument to the selector because they do not appear in the database
bool _use_arc_additions_ {true}
bool _use_arc_deletions_ {true}
bool _use_arc_reversals_ {true}
bool _use_arc_triangle_deletions_ {true}

Detailed Description

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
class gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >

The mecanism to compute the next available graph changes for directed structure learning search algorithms.

Template Parameters
INVARIABLE_CONSTRAINT_TYPEinvariable constraints are those constraints whose satisfaction does not depend on the current DiGraph. For instance topological ordering constraints always yield the same results whatever the digraph.
VARIABLE_CONSTRAINT_TYPEvariable constraints are those constraints that require examining the current DiGraph to determine whether they are satisfied or not. For instance, limits on the indegrees of the nodes can be reached or not depending on the DiGraph of interest.

Definition at line 75 of file graphChangesSelector4DiGraph.h.

Constructor & Destructor Documentation

◆ GraphChangesSelector4DiGraph() [1/3]

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::GraphChangesSelector4DiGraph ( Score & score,
INVARIABLE_CONSTRAINT_TYPE & invariable_constraints,
VARIABLE_CONSTRAINT_TYPE & variable_constraints )

default constructor

Parameters
scorethe score used to select the best next change
invariable_constraints
variable_constraints
changes_generator

References score().

Referenced by GraphChangesSelector4DiGraph(), GraphChangesSelector4DiGraph(), ~GraphChangesSelector4DiGraph(), operator=(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GraphChangesSelector4DiGraph() [2/3]

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::GraphChangesSelector4DiGraph ( const GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > & from)

copy constructor

References GraphChangesSelector4DiGraph().

Here is the call graph for this function:

◆ GraphChangesSelector4DiGraph() [3/3]

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::GraphChangesSelector4DiGraph ( GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > && from)

move constructor

References GraphChangesSelector4DiGraph().

Here is the call graph for this function:

◆ ~GraphChangesSelector4DiGraph()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::~GraphChangesSelector4DiGraph ( )

destructor

References GraphChangesSelector4DiGraph().

Here is the call graph for this function:

Member Function Documentation

◆ _addArcAdditionToSortedChanges_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_addArcAdditionToSortedChanges_ ( const ArcAddition & change)
private

adds an ArcAddition to sorted_changes if possible

Warning
if the invariable constraints forbid this ArcAddition, then nothing is done. In particular, no exception is raised.

◆ _addArcDeletionToSortedChanges_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_addArcDeletionToSortedChanges_ ( const ArcDeletion & change)
private

adds an ArcDeletion to sorted_changes if possible

Warning
if the invariable constraints forbid this ArcDeletion, then nothing is done. In particular, no exception is raised.

◆ _addArcReversalToSortedChanges_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_addArcReversalToSortedChanges_ ( const ArcReversal & change)
private

adds an ArcReversal to sorted_changes if possible

Warning
if the invariable constraints forbid this ArcReversal, then nothing is done. In particular, no exception is raised.

◆ _addArcTriangleDeletion1ToSortedChanges_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_addArcTriangleDeletion1ToSortedChanges_ ( const ArcTriangleDeletion1 & change)
private

adds an ArcTriangleDeletion1 to sorted_changes if possible

Warning
if the invariable constraints forbid this ArcTriangleDeletion1, then nothing is done. In particular, no exception is raised.

◆ _addArcTriangleDeletion2ToSortedChanges_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_addArcTriangleDeletion2ToSortedChanges_ ( const ArcTriangleDeletion2 & change)
private

adds an ArcTriangleDeletion2 to sorted_changes if possible

Warning
if the invariable constraints forbid this ArcTriangleDeletion2, then nothing is done. In particular, no exception is raised.

◆ _applyArcAddition_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_applyArcAddition_ ( const ArcAddition & change,
bool update_contraints )
private

indicate to the selector that an ArcAddition has been applied

◆ _applyArcDeletion_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_applyArcDeletion_ ( const ArcDeletion & change,
bool update_contraints )
private

indicate to the selector that an ArcDeletion has been applied

◆ _applyArcReversal_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_applyArcReversal_ ( const ArcReversal & change,
bool update_contraints )
private

indicate to the selector that an ArcReversal has been applied

◆ _applyArcTriangleDeletion1_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_applyArcTriangleDeletion1_ ( const ArcTriangleDeletion1 & change,
bool update_contraints )
private

indicate to the selector that an ArcTriangleDeletion1 has been applied

◆ _applyArcTriangleDeletion2_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_applyArcTriangleDeletion2_ ( const ArcTriangleDeletion2 & change,
bool update_contraints )
private

indicate to the selector that an ArcTriangleDeletion2 has been applied

◆ _initSortedChangesWithArcAdditions_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_initSortedChangesWithArcAdditions_ ( const DiGraph & graph)
private

add all the possible ArcAdditions to initialize sorted_changes

◆ _initSortedChangesWithArcDeletions_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_initSortedChangesWithArcDeletions_ ( const DiGraph & graph)
private

add all the possible ArcDeletions to initialize sorted_changes

◆ _initSortedChangesWithArcReversals_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_initSortedChangesWithArcReversals_ ( const DiGraph & graph)
private

add all the possible ArcReversals to initialize sorted_changes

◆ _initSortedChangesWithArcTriangleDeletions_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_initSortedChangesWithArcTriangleDeletions_ ( const DiGraph & graph)
private

add all the possible ArcTriangleDeletions to initialize sorted_changes

◆ _scoreAfterAddingParent_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
double gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_scoreAfterAddingParent_ ( const NodeId node,
const NodeId new_parent )
private

computes the new score of node given that we added it a new parent

◆ _scoreAfterAddingParents_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
double gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_scoreAfterAddingParents_ ( const NodeId node,
const NodeId new_parent1,
const NodeId new_parent2 )
private

computes the new score of node given that we added it two new parents

◆ _scoreAfterRemovingParent_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
double gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_scoreAfterRemovingParent_ ( const NodeId node,
const NodeId parent )
private

computes the new score of node given that we removed a parent

◆ _scoreAfterRemovingParents_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
double gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_scoreAfterRemovingParents_ ( const NodeId node,
const NodeId parent1,
const NodeId parent2 )
private

computes the new score of node given that we removed two parents

◆ _updateArcAdditionScore_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_updateArcAdditionScore_ ( const NodeId tail,
const NodeId head )
private

updates the score of a given ArcAddition

◆ _updateArcDeletionScore_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_updateArcDeletionScore_ ( const NodeId tail,
const NodeId head )
private

updates the score of a given ArcDeletion

◆ _updateArcReversalScore_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_updateArcReversalScore_ ( const NodeId tail,
const NodeId head )
private

updates the score of a given ArcReversal

◆ _updateTriangleDeletionsScoresFromNeighborhood_()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_updateTriangleDeletionsScoresFromNeighborhood_ ( const NodeId changed_node)
private

update the score of the triangle deletions which contain a node whose neighborhood has changed

◆ applyChange()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::applyChange ( const GraphChange & change)

indicate to the selector that a change has been applied

◆ arcAdditionsEnabled()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
bool gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::arcAdditionsEnabled ( ) const

indicates whether the selector allows the application of arc additions

◆ arcDeletionsEnabled()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
bool gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::arcDeletionsEnabled ( ) const

indicates whether the selector allows the application of arc deletions

◆ arcReversalsEnabled()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
bool gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::arcReversalsEnabled ( ) const

indicates whether the selector allows the application of arc reversals

◆ arcTriangleDeletionsEnabled()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
bool gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::arcTriangleDeletionsEnabled ( ) const

indicates whether the selector allows the application of arc triangle deletions

◆ bestChange()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
const GraphChange & gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::bestChange ( )

returns the best graph change to examine

Exceptions
NotFoundexception is thrown if the selector is empty

◆ bestDeltaScore()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
double gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::bestDeltaScore ( )

return the score of the best graph change

Warning
If you want both to get the bestScore and the bestChange, consider first to get the bestChange and, then, the score of this best change, it will be faster than calling both the bestChange and bestScore methods.
Exceptions
NotFoundexception is thrown if the selector is empty

◆ deltaScore()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
double gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::deltaScore ( const GraphChange & change,
const bool internal_change = false ) const

return the score of a given change

Parameters
changethe GraphChange whose delta score we want
internal_changeIf the change is stored in memory within the selector (essentially, it results from a call to method bestChange), then set internal_change to true. This will speed-up the computations. Otherwise, set it to false.
Exceptions
NotFoundexception is thrown if the selector is empty

◆ finalizeGraph()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::finalizeGraph ( DiGraph & graph)

adds some nodes that were removed because they did not belong to the database

This function should be called at the end of the learning in order to add to the learnt graph all the nodes that were removed from it because we had no data over them

◆ invariableConstraints()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
INVARIABLE_CONSTRAINT_TYPE & gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::invariableConstraints ( )

returns the set of invariable constraints used by the selector

◆ isChangeValid()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
bool gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::isChangeValid ( const GraphChange & change) const

indicates whether a given change is valid or not

◆ operator=() [1/2]

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > & gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::operator= ( const GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > & from)

copy operator

References GraphChangesSelector4DiGraph().

Here is the call graph for this function:

◆ operator=() [2/2]

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > & gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::operator= ( GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE > && from)

move operator

References GraphChangesSelector4DiGraph().

Here is the call graph for this function:

◆ score()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
double gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::score ( const NodeId node) const

returns the current score of a node

Referenced by GraphChangesSelector4DiGraph().

Here is the caller graph for this function:

◆ setGraph()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::setGraph ( DiGraph & graph)

sets the graph from which scores are computed

◆ useArcAdditions()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::useArcAdditions ( bool use)

sets whether or not the selector allows the application of arc additions

Referenced by gum::learning::IBNLearner::learnDag_().

Here is the caller graph for this function:

◆ useArcDeletions()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::useArcDeletions ( bool use)

sets whether or not the selector allows the application of arc deletions

Referenced by gum::learning::IBNLearner::learnDag_().

Here is the caller graph for this function:

◆ useArcReversals()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::useArcReversals ( bool use)

sets whether or not the selector allows the application of arc reversals

Referenced by gum::learning::IBNLearner::learnDag_().

Here is the caller graph for this function:

◆ useArcTriangleDeletions()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
void gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::useArcTriangleDeletions ( bool use)

sets whether or not the selector allows the application of arc triangle deletions

Referenced by gum::learning::IBNLearner::learnDag_().

Here is the caller graph for this function:

◆ variableConstraints()

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
VARIABLE_CONSTRAINT_TYPE & gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::variableConstraints ( )

returns the set of variable constraints used by the selector

Member Data Documentation

◆ _graph_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
DiGraph* gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_graph_ {nullptr}
private

the graph that we learn

Definition at line 231 of file graphChangesSelector4DiGraph.h.

231{nullptr};

◆ _invariable_constraints_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
INVARIABLE_CONSTRAINT_TYPE* gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_invariable_constraints_
private

the set of constraints which, for a given change, always return the same output

An example of such a constraint is the slice order constraint: if x and y are in slices 1 and 2 respectively, it will always be impossible to add an arc y->x, whatever the current graph. Mandatory arcs and forbidden arcs are also constraints of this type.

Definition at line 218 of file graphChangesSelector4DiGraph.h.

◆ _node_parents_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
NodeProperty< std::vector< NodeId > > gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_node_parents_
private

the set of parents of each node (speeds-up score computations)

Definition at line 237 of file graphChangesSelector4DiGraph.h.

◆ _node_scores_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
NodeProperty< double > gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_node_scores_
private

the current score of each node

Definition at line 234 of file graphChangesSelector4DiGraph.h.

◆ _removed_nodes_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
NodeSet gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_removed_nodes_
private

the set of nodes removed from the graph passed in argument to the selector because they do not appear in the database

Definition at line 257 of file graphChangesSelector4DiGraph.h.

◆ _score_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
Score* gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_score_
private

the scoring function

Definition at line 207 of file graphChangesSelector4DiGraph.h.

◆ _sorted_changes_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
SortedPriorityQueue< GraphChange, double > gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_sorted_changes_
private

the graph changes sorted by decreasing delta score value

The graph changes in this queue are those that are allowed according to the invariable_constraints. Their priority corresponds to the delta that should be added to the overall score of the graph if the graph change is applied.

Warning
Note that there is never any guarantee that the changes in this queue are allowed according to the variable_constraints, hence, to look for the next best change, we should iterate over this queue and, for each element, check whether it is variable-allowed.

Definition at line 251 of file graphChangesSelector4DiGraph.h.

◆ _use_arc_additions_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
bool gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_use_arc_additions_ {true}
private

Definition at line 259 of file graphChangesSelector4DiGraph.h.

259{true};

◆ _use_arc_deletions_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
bool gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_use_arc_deletions_ {true}
private

Definition at line 260 of file graphChangesSelector4DiGraph.h.

260{true};

◆ _use_arc_reversals_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
bool gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_use_arc_reversals_ {true}
private

Definition at line 261 of file graphChangesSelector4DiGraph.h.

261{true};

◆ _use_arc_triangle_deletions_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
bool gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_use_arc_triangle_deletions_ {true}
private

Definition at line 262 of file graphChangesSelector4DiGraph.h.

262{true};

◆ _variable_constraints_

template<typename INVARIABLE_CONSTRAINT_TYPE, typename VARIABLE_CONSTRAINT_TYPE>
VARIABLE_CONSTRAINT_TYPE* gum::learning::GraphChangesSelector4DiGraph< INVARIABLE_CONSTRAINT_TYPE, VARIABLE_CONSTRAINT_TYPE >::_variable_constraints_
private

the set of constraints whose outputs can change depending on the current graph

An example of such a constraint is the indegree constraint: depending on the current number of parents of node x, it may or may not be possible to add a new arc incoming into x.

Definition at line 227 of file graphChangesSelector4DiGraph.h.


The documentation for this class was generated from the following file: