Skip to content

Navigation Menu

Sign in
Sign up

Repository files navigation

Causal Inference & Causal ML — the Practitioner's Path

A self-paced, interactive course: from "correlation isn't causation" to double ML, causal forests, and uplift-based targeting — organized around the tools you'd actually use at work (DoWhy → EconML), with the theory delivered exactly where it changes what you do.

Built for a quant with strong stats/ML/Python and no prior causal-inference training. Every module runs against simulated data with known ground truth (the only place you can check an estimator against the answer) and a classic real dataset.

Setup (once)

uv venv .venv --python 3.11
uv pip install --python .venv/bin/python -r requirements.txt
.venv/bin/python -m ipykernel install --user --name causalml --display-name "Python (causalml)"
.venv/bin/python data/download_data.py # caches 3 datasets; rest is bundled/simulated
.venv/bin/python -m pytest tests/ -q # sanity: toolkit green

Open notebooks with cd notebooks && ../.venv/bin/jupyter lab (or your IDE) and select the Python (causalml) kernel.

The course map

# Notebook You learn to... Data
00 00_setup_big_picture run the whole model→identify→estimate→refute workflow once Simpson's-paradox sim
01 01_potential_outcomes think in counterfactuals; ATE/ATT; why naive comparisons lie god-mode sim
02 02_causal_graphs draw DAGs; pick adjustment sets; fear colliders triad sims
03 03_randomized_experiments analyze A/B tests; variance reduction; not peek A/B sim
04 04_regression_adjustment adjust with regression (FWL); spot bad controls sims + LaLonde
05 05_propensity_scores matching, IPW, overlap & balance diagnostics LaLonde
06 06_doubly_robust_refutation AIPW; attack your own estimate with refuters sims + LaLonde
07 07_instrumental_variables 2SLS, weak instruments, LATE Card 1995
08 08_difference_in_differences DiD, event studies, pre-trends organ donations
09 09_regression_discontinuity local-linear RDD, bandwidths, manipulation gov transfers
10 10_double_ml cross-fitting, orthogonalization, LinearDML 401(k)
11 11_heterogeneous_effects meta-learners, causal forests, CATE CIs HTE sim + 401(k)
12 12_uplift_policy Qini, targeting policies, policy value Hillstrom e-mail
13 13_capstone do a full analysis yourself, end to end your choice

Part I = 00–03 (foundations), Part II = 04–09 (observational & quasi-experimental with DoWhy/statsmodels), Part III = 10–13 (causal ML with EconML).

How to study a module

  1. Predict first. Every 🔮 prompt asks you to commit to a number or sign before running the next cell. Actually do it — that gap between your guess and the output is where the learning happens.
  2. Run and read top to bottom. The 💥 sections deliberately break the estimator on data where we know the truth — watch how it fails.
  3. Do the 📝 exercises: replace ans_* = None with your code; cl.check(...) grades you instantly (⏳ not attempted / ✅ / ❌).
  4. Stuck or ✅-but-unsure-why? Open the matching notebook in solutions/ (kept with executed outputs so you can read it without running).
  5. Optional but recommended: bring any module into a Claude Code session — "Walk me through module 07 Socratically; probe my understanding" — or bring your capstone for a review against its rubric.

Repo layout

notebooks/ the course (outputs cleared — run them yourself)
solutions/ worked exercises, executed outputs kept
course_lib/ simulators w/ ground truth, loaders, plots, check()
build/py/ jupytext py:percent sources the notebooks are built from
data/ download script + cache; see data/README.md
tests/ contract tests for course_lib
docs/ design spec + implementation plan

If you edit course content, edit build/py/*.py and rebuild with jupytext --to ipynb, or edit the notebook and back-sync — the py files are the canonical source.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /