![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
Consolidated d-separation utilities (DAG-centric). More...
#include <separation.h>
Static Public Member Functions | |
| static bool | isDSeparated (const DAG &dag, const NodeSet &X, const NodeSet &Y, const NodeSet &Z) |
| Test ( X \perp!!!\perp Y \mid Z ) (general d-separation). | |
| static bool | isBackdoorSeparated (const DAG &dag, const NodeSet &X, const NodeSet &Y, const NodeSet &Z) |
| Backdoor-style restriction: only paths whose first edge points into X. | |
| static bool | isForwardSeparated (const DAG &dag, const NodeSet &X, const NodeSet &Y, const NodeSet &Z) |
| Forward-style restriction: only paths whose first edge leaves X. | |
| static DAG | reduceForDSeparation (const DAG &dag, const NodeSet &X, const NodeSet &Y, const NodeSet &Z) |
| Barren-node pruning relative to the interest set (X \cup Y \cup Z). | |
| static NodeSet | findBarrenNodes (const DAG &dag, const NodeSet &evidenceZ, const NodeSet &targetsXY) |
| Compute barren nodes given evidence and targets. | |
| static bool | isAncestorOf (const DAG &dag, NodeId x, NodeId y) |
| Is x an ancestor of y? | |
| static bool | isDescendantOf (const DAG &dag, NodeId x, NodeId y) |
| Is x a descendant of y? | |
Static Private Member Functions | |
| static bool | anyUndirectedConnection (const UndiGraph &ug, const NodeSet &A, const NodeSet &B) |
| Check if any node in A is undirected-connected to any node in B. | |
Consolidated d-separation utilities (DAG-centric).
High-level helpers to test (conditional) independence in directed acyclic graphs (DAGs) using the d-separation criterion. Wherever possible, this class delegates to aGrUM-provided primitives and mirrors pyAgrum semantics.
C++ ↔ pyAgrum correspondence
Definition at line 75 of file separation.h.
|
staticprivate |
Check if any node in A is undirected-connected to any node in B.
Pyagrum counterpart: _is_path_x_y.
| ug | An undirected graph (usually a moralized ancestral graph). |
| A | First node set. |
| B | Second node set. |
Definition at line 217 of file separation.cpp.
References gum::graph::areConnected().
Referenced by isForwardSeparated().
|
static |
Compute barren nodes given evidence and targets.
Pyagrum counterpart: _barren_nodes.
Thin wrapper over BarrenNodesFinder::barrenNodes().
| dag | The causal DAG. |
| evidenceZ | Evidence/conditioning set Z. |
| targetsXY | Union of target nodes (typically (X \cup Y)). |
Implementation note: Conservative stand-in: nodes outside Anc(X∪Y∪Z) are "barren" for our purpose. If BarrenNodesFinder::barrenNodes() is available, you can implement this as a thin wrapper around it.
Definition at line 182 of file separation.cpp.
References gum::BarrenNodesFinder::barrenNodes(), gum::BarrenNodesFinder::setEvidence(), and gum::BarrenNodesFinder::setTargets().
Is x an ancestor of y?
Pyagrum counterpart: _is_ascendant.
| dag | The causal DAG. |
| x | Candidate ancestor. |
| y | Candidate descendant. |
Definition at line 198 of file separation.cpp.
References gum::DiGraph::ancestors(), and gum::Set< Key >::contains().
|
static |
Backdoor-style restriction: only paths whose first edge points into X.
Pyagrum counterpart: isDSep_parents / _isDSep_tech2_parents.
Semantics: tests whether Z blocks all paths from Y to X that enter X via an incoming edge (the “backdoor graph” (G_{\underline{X}})).
Implementation:
| dag | The causal DAG. |
| X | Set of “treatment” nodes (incoming-edge focus). |
| Y | Set of outcome nodes. |
| Z | Conditioning set. |
Definition at line 91 of file separation.cpp.
References gum::ArcGraphPart::children(), gum::DAG::dSeparation(), gum::ArcGraphPart::eraseArc(), gum::ArcGraphPart::existsArc(), and gum::Set< Key >::size().
Referenced by gum::CausalImpact< GUM_ELEMENT >::_namesToIds_(), gum::DoorCriteria::enumerateBackdoorSets(), gum::DoorCriteria::enumerateFrontdoorSets(), gum::DoorCriteria::hasBackdoorPath(), gum::DoorCriteria::satisfiesBackdoorCriterion(), and gum::DoorCriteria::satisfiesFrontdoorCriterion().
Is x a descendant of y?
Pyagrum counterpart: _is_descendant.
| dag | The causal DAG. |
| x | Candidate descendant. |
| y | Candidate ancestor. |
Definition at line 205 of file separation.cpp.
References gum::Set< Key >::contains(), and gum::DiGraph::descendants().
|
static |
Test ( X \perp!!!\perp Y \mid Z ) (general d-separation).
Pyagrum counterpart: isDSep (delegates to isDSep_tech2).
Delegates to DAG::dSeparation, which:
Definition at line 80 of file separation.cpp.
References gum::DAG::dSeparation().
Referenced by gum::DoCalculus< GUM_SCALAR >::doCalculusWithObservation().
|
static |
Forward-style restriction: only paths whose first edge leaves X.
Pyagrum counterpart: _isDSep_tech2_children.
Semantics: tests whether Z blocks all paths starting from X via an outgoing edge (children-first restriction used in frontdoor checks).
Outline:
| dag | The causal DAG. |
| X | Set of start nodes (outgoing-edge focus). |
| Y | Set of target nodes. |
| Z | Conditioning set. |
Definition at line 117 of file separation.cpp.
References gum::UndiGraph::addEdge(), gum::NodeGraphPart::addNodeWithId(), anyUndirectedConnection(), gum::ArcGraphPart::children(), gum::EdgeGraphPart::existsEdge(), gum::NodeGraphPart::existsNode(), gum::Set< Key >::insert(), and gum::DAG::moralizedAncestralGraph().
|
static |
Barren-node pruning relative to the interest set (X \cup Y \cup Z).
Pyagrum counterpart: dSep_reduce (uses _barren_nodes).
Uses BarrenNodesFinder with evidence = Z and targets = X ∪ Y to compute barren nodes, then removes them from a copy of dag.
| dag | The causal DAG to prune. |
| X | Source nodes of interest. |
| Y | Target nodes of interest. |
| Z | Evidence/conditioning set. |
Definition at line 153 of file separation.cpp.
References gum::BarrenNodesFinder::barrenNodes(), gum::DiGraph::eraseNode(), gum::NodeGraphPart::existsNode(), gum::BarrenNodesFinder::setEvidence(), and gum::BarrenNodesFinder::setTargets().
Referenced by gum::DoorCriteria::enumerateBackdoorSets(), gum::DoorCriteria::enumerateFrontdoorSets(), and gum::DoorCriteria::satisfiesFrontdoorCriterion().