"A counterfactual asks the model to remember what happened and imagine what would have happened instead."
Overview
Counterfactual reasoning studies unit-level alternatives by combining factual evidence with a causal model of interventions.
Causal inference is the part of the curriculum that separates observing from doing. It asks which assumptions allow a learner to move from associations in data to claims about interventions, alternatives, and mechanisms.
This section is written in LaTeX Markdown. Inline mathematics uses $...$, and display equations use `
`. The notes emphasize graph assumptions, intervention notation, counterfactual semantics, and the estimand-estimator split.
Prerequisites
Companion Notebooks
| Notebook | Description |
|---|---|
| theory.ipynb | Executable demonstrations for counterfactuals |
| exercises.ipynb | Graded practice for counterfactuals |
Learning Objectives
After completing this section, you will be able to:
- Define SCMs, structural assignments, and intervention distributions
- Distinguish conditioning from intervention using the do-operator
- Apply d-separation to simple causal graphs
- State backdoor and frontdoor adjustment formulas
- Separate causal estimands from statistical estimators
- Compute ATE, ATT, and simple counterfactual quantities
- Explain abduction, action, and prediction in SCM counterfactuals
- Describe constraint-based and score-based causal discovery
- Identify assumptions behind causal discovery algorithms
- Connect causal inference to robust ML, fairness, recommendation, and LLM agents
Study Flow
- Read the pages in order and pause after each page to restate the main definition or theorem.
- Run
theory.ipynbwhen you want to check the formulas numerically. - Use
exercises.ipynbafter the reading path, not before it. - Return to this overview page when you need the chapter-level navigation.