Skip to main content

Module causal_inference

Module causal_inference 

Source
Expand description

Causal Inference Engine — do-calculus, interventional distributions, and counterfactual reasoning over Gaussian structural equation models.

§Overview

This module implements a full causal inference pipeline built on directed acyclic graphs (DAGs) with Gaussian node semantics. The design follows Pearl’s do-calculus framework:

  1. Structural Causal Model (SCM) — each node is parameterised by a mean and a variance under a Gaussian structural equation model.
  2. Interventional inference (do_calculus) — cuts incoming edges to the intervened node and propagates the fixed value through all directed paths to the target, accumulating linear causal effects.
  3. Counterfactual inference (counterfactual) — applies an intervention and conditions on observed evidence by adding a weighted correction from each evidence node to the target.
  4. Average Causal Effect (average_causal_effect) — contrasts interventional distributions to quantify treatment effects.
  5. d-separation — checks whether two nodes are conditionally independent given a set of observed variables.
  6. Backdoor paths — enumerates confounding paths for identifiability analysis.

Structs§

CausalEdge
A directed edge in the causal graph carrying a linear strength coefficient.
CausalGraph
The underlying directed acyclic graph over causal nodes.
CausalInferenceEngine
Production-grade causal inference engine.
CausalNode
A variable in the structural causal model parameterised by a Gaussian prior.
CausalNodeId
Opaque identifier for a node inside a CausalGraph.
CausalStats
Summary statistics about the structure of a CausalGraph.
CounterfactualQuery
A counterfactual query: what would target be if we had applied intervention, given that we observed evidence?
InferenceResult
The result returned by an inference query.
Intervention
A hard intervention: set node node to exactly value (written do(X = value)).

Enums§

CausalEdgeType
Semantic classification for an edge in a CausalGraph.
CausalError
Errors that can be produced by the CausalInferenceEngine.