![]() |
aGrUM 3.0.0
a C++ library for (probabilistic) graphical models
|
Instance-based do-calculus utilities bound to a single CausalModel. More...
#include <doCalculus.h>
Public Types | |
| using | FormulaPtr = std::unique_ptr< ASTtree< GUM_SCALAR > > |
| Owned pointer to an AST representing a probability expression. | |
| using | NameList = std::vector< std::string > |
| Convenience container for name-based overloads. | |
Public Member Functions | |
| DoCalculus (const CausalModel< GUM_SCALAR > &cm) noexcept | |
| const CausalModel< GUM_SCALAR > & | model () const noexcept |
| FormulaPtr | getBackDoorTree (NodeId cause, NodeId effect, const NodeSet &zset) const |
| FormulaPtr | getBackDoorTree (std::string_view causeName, std::string_view effectName, const NameList &zNames) const |
| FormulaPtr | getFrontDoorTree (NodeId cause, NodeId effect, const NodeSet &zset) const |
| FormulaPtr | getFrontDoorTree (std::string_view causeName, std::string_view effectName, const NameList &zNames) const |
| FormulaPtr | identifyingIntervention (const NodeSet &Y, const NodeSet &X) const |
| ID: identify P(Y | do(X)) (NodeId-based). | |
| FormulaPtr | identifyingIntervention (const NameList &Y, const NameList &X) const |
| ID: identify P(Y | do(X)) (name-based). | |
| FormulaPtr | doCalculus (const NodeSet &on, const NodeSet &doing) const |
| Thin wrapper around ID: doCalculus(on, doing). | |
| FormulaPtr | doCalculus (const NameList &on, const NameList &doing) const |
| FormulaPtr | doCalculusWithObservation (const NodeSet &on, const NodeSet &doing, const NodeSet &knowing) const |
| IDC: identify P(on | do(doing), knowing). | |
| FormulaPtr | doCalculusWithObservation (const NameList &on, const NameList &doing, const NameList &knowing) const |
Private Member Functions | |
| std::vector< NodeSet > | _cDecomposition_ (const CausalModel< GUM_SCALAR > &cm) const |
| c-decomposition (confounding components) among observed nodes. | |
| std::vector< NodeSet > | _cDecompositionOn_ (const CausalModel< GUM_SCALAR > &sub) const |
| c-decomposition on an induced submodel (observed nodes only). | |
| std::vector< NodeId > | _topoObserved_ (const CausalModel< GUM_SCALAR > &cm) const |
| Topological order over observed nodes (ignoring latent parents). | |
| FormulaPtr | _ID_ (const CausalModel< GUM_SCALAR > &cm, const NodeSet &Y, const NodeSet &X, std::unique_ptr< ASTtree< GUM_SCALAR > > P) const |
| ID core (recursive), with optional accumulated distribution P (AST) to carry in decompositions. | |
Static Private Member Functions | |
| static NodeSet | _ancestorsIn_ (const DAG &g, const NodeSet &T) |
| Ancestors (in DAG g) of a set T (including T). | |
| static DAG | _removeIncomingInto_ (const DAG &dag, const NodeSet &X) |
| DAG copy with all incoming arcs into X removed (G_{\overline X}). | |
| static DAG | _removeInIntoDoing_outOfKnowing_ (const DAG &dag, const NodeSet &doing, const NodeSet &knowing) |
| IDC helper: DAG copy with incoming into doing removed AND outgoing from knowing removed. | |
| static std::string | _hedgeExceptionMsg (const CausalModel< GUM_SCALAR > &cm, const NodeSet &Y, const NodeSet &X, const NodeSet &V, const NodeSet &S) |
| Format a hedge exception message. | |
Private Attributes | |
| const CausalModel< GUM_SCALAR > & | _cm |
Instance-based do-calculus utilities bound to a single CausalModel.
This class provides:
Returned ASTs are evaluated against the observational BN of the bound causal model.
Definition at line 78 of file doCalculus.h.
| using gum::DoCalculus< GUM_SCALAR >::FormulaPtr = std::unique_ptr< ASTtree< GUM_SCALAR > > |
Owned pointer to an AST representing a probability expression.
Definition at line 81 of file doCalculus.h.
| using gum::DoCalculus< GUM_SCALAR >::NameList = std::vector< std::string > |
Convenience container for name-based overloads.
Definition at line 84 of file doCalculus.h.
|
inlineexplicitnoexcept |
Definition at line 88 of file doCalculus.h.
References _cm.
|
staticprivate |
Ancestors (in DAG g) of a set T (including T).
Definition at line 378 of file doCalculus_tpl.h.
References gum::NodeGraphPart::asNodeSet(), gum::Set< Key >::contains(), gum::Set< Key >::insert(), gum::NodeGraphPart::nodes(), and gum::ArcGraphPart::parents().
Referenced by _ID_().
|
private |
c-decomposition (confounding components) among observed nodes.
Definition at line 286 of file doCalculus_tpl.h.
References gum::CausalModel< GUM_SCALAR >::children(), gum::Set< Key >::contains(), gum::Set< Key >::insert(), gum::CausalModel< GUM_SCALAR >::latentVariablesIds(), and gum::CausalModel< GUM_SCALAR >::observationalBN().
Referenced by _cDecompositionOn_(), and _ID_().
|
private |
c-decomposition on an induced submodel (observed nodes only).
Definition at line 339 of file doCalculus_tpl.h.
References _cDecomposition_().
Referenced by _ID_().
|
staticprivate |
Format a hedge exception message.
Definition at line 252 of file doCalculus_tpl.h.
References gum::CausalModel< GUM_SCALAR >::nameFromId().
Referenced by _ID_().
|
private |
ID core (recursive), with optional accumulated distribution P (AST) to carry in decompositions.
Definition at line 528 of file doCalculus_tpl.h.
References _ancestorsIn_(), _cDecomposition_(), _cDecompositionOn_(), _hedgeExceptionMsg(), _ID_(), _removeIncomingInto_(), _topoObserved_(), gum::CausalModel< GUM_SCALAR >::causalDAG(), gum::Set< Key >::contains(), gum::Set< Key >::empty(), GUM_ERROR, gum::CausalModel< GUM_SCALAR >::inducedCausalSubModel(), gum::Set< Key >::insert(), gum::CausalModel< GUM_SCALAR >::latentVariablesIds(), gum::CausalModel< GUM_SCALAR >::nameFromId(), gum::CausalModel< GUM_SCALAR >::observationalBN(), and gum::Set< Key >::size().
Referenced by _ID_(), and identifyingIntervention().
|
staticprivate |
DAG copy with all incoming arcs into X removed (G_{\overline X}).
Definition at line 399 of file doCalculus_tpl.h.
References gum::ArcGraphPart::eraseArc(), and gum::ArcGraphPart::parents().
Referenced by _ID_().
|
staticprivate |
IDC helper: DAG copy with incoming into doing removed AND outgoing from knowing removed.
Definition at line 410 of file doCalculus_tpl.h.
References gum::ArcGraphPart::children(), gum::ArcGraphPart::eraseArc(), and gum::ArcGraphPart::parents().
Referenced by doCalculusWithObservation().
|
private |
Topological order over observed nodes (ignoring latent parents).
Definition at line 345 of file doCalculus_tpl.h.
References gum::CausalModel< GUM_SCALAR >::observationalBN(), and gum::Set< Key >::size().
Referenced by _ID_().
| DoCalculus< GUM_SCALAR >::FormulaPtr gum::DoCalculus< GUM_SCALAR >::doCalculus | ( | const NameList & | on, |
| const NameList & | doing ) const |
Definition at line 457 of file doCalculus_tpl.h.
References identifyingIntervention().
| DoCalculus< GUM_SCALAR >::FormulaPtr gum::DoCalculus< GUM_SCALAR >::doCalculus | ( | const NodeSet & | on, |
| const NodeSet & | doing ) const |
Thin wrapper around ID: doCalculus(on, doing).
Definition at line 451 of file doCalculus_tpl.h.
References identifyingIntervention().
| DoCalculus< GUM_SCALAR >::FormulaPtr gum::DoCalculus< GUM_SCALAR >::doCalculusWithObservation | ( | const NameList & | on, |
| const NameList & | doing, | ||
| const NameList & | knowing ) const |
Definition at line 509 of file doCalculus_tpl.h.
References _cm, doCalculusWithObservation(), and gum::Set< Key >::insert().
| DoCalculus< GUM_SCALAR >::FormulaPtr gum::DoCalculus< GUM_SCALAR >::doCalculusWithObservation | ( | const NodeSet & | on, |
| const NodeSet & | doing, | ||
| const NodeSet & | knowing ) const |
IDC: identify P(on | do(doing), knowing).
Definition at line 463 of file doCalculus_tpl.h.
References _cm, _removeInIntoDoing_outOfKnowing_(), doCalculusWithObservation(), gum::Set< Key >::empty(), identifyingIntervention(), gum::Set< Key >::insert(), and gum::Separation::isDSeparated().
Referenced by doCalculusWithObservation(), and doCalculusWithObservation().
| DoCalculus< GUM_SCALAR >::FormulaPtr gum::DoCalculus< GUM_SCALAR >::getBackDoorTree | ( | NodeId | cause, |
| NodeId | effect, | ||
| const NodeSet & | zset ) const |
Definition at line 92 of file doCalculus_tpl.h.
References _cm, gum::Set< Key >::contains(), gum::Set< Key >::empty(), GUM_ERROR, gum::Set< Key >::insert(), gum::productOfTrees(), and gum::Set< Key >::size().
Referenced by gum::CausalImpact< GUM_ELEMENT >::_disjoint_(), and getBackDoorTree().
| DoCalculus< GUM_SCALAR >::FormulaPtr gum::DoCalculus< GUM_SCALAR >::getBackDoorTree | ( | std::string_view | causeName, |
| std::string_view | effectName, | ||
| const NameList & | zNames ) const |
Definition at line 151 of file doCalculus_tpl.h.
References _cm, getBackDoorTree(), and gum::Set< Key >::insert().
| DoCalculus< GUM_SCALAR >::FormulaPtr gum::DoCalculus< GUM_SCALAR >::getFrontDoorTree | ( | NodeId | cause, |
| NodeId | effect, | ||
| const NodeSet & | zset ) const |
Definition at line 166 of file doCalculus_tpl.h.
References _cm, gum::Set< Key >::contains(), gum::Set< Key >::empty(), GUM_ERROR, gum::Set< Key >::insert(), and gum::Set< Key >::size().
Referenced by getFrontDoorTree().
| DoCalculus< GUM_SCALAR >::FormulaPtr gum::DoCalculus< GUM_SCALAR >::getFrontDoorTree | ( | std::string_view | causeName, |
| std::string_view | effectName, | ||
| const NameList & | zNames ) const |
Definition at line 234 of file doCalculus_tpl.h.
References _cm, getFrontDoorTree(), and gum::Set< Key >::insert().
| DoCalculus< GUM_SCALAR >::FormulaPtr gum::DoCalculus< GUM_SCALAR >::identifyingIntervention | ( | const NameList & | Y, |
| const NameList & | X ) const |
ID: identify P(Y | do(X)) (name-based).
Definition at line 439 of file doCalculus_tpl.h.
References _cm, identifyingIntervention(), and gum::Set< Key >::insert().
| DoCalculus< GUM_SCALAR >::FormulaPtr gum::DoCalculus< GUM_SCALAR >::identifyingIntervention | ( | const NodeSet & | Y, |
| const NodeSet & | X ) const |
ID: identify P(Y | do(X)) (NodeId-based).
Definition at line 433 of file doCalculus_tpl.h.
Referenced by doCalculus(), doCalculus(), doCalculusWithObservation(), and identifyingIntervention().
|
noexcept |
|
private |
Definition at line 127 of file doCalculus.h.
Referenced by DoCalculus(), doCalculusWithObservation(), doCalculusWithObservation(), getBackDoorTree(), getBackDoorTree(), getFrontDoorTree(), getFrontDoorTree(), identifyingIntervention(), identifyingIntervention(), and model().