An interactive portfolio-grade causal inference dashboard built with Dash in Python. Applies a number of causal methods to a publicly available retail email marketing dataset (Hillstrom, 2008), allowing side-by-side comparison of estimates, uncertainty and assumptions.
| Tab | Method | Library |
|---|---|---|
| 2 | Matched-Control (Propensity Score Matching) | scikit-learn |
| 3 | Bayesian A/B Test | PyMC, ArviZ |
| 4 | Uplift Modelling / HTE (T-Learner, S-Learner) | scikit-uplift |
| 5 | Multi-Arm OLS w/ Interactions | statsmodels |
The MineThatData Email Analytics dataset (Hillstrom, 2008) captures a randomised marketing experiment across 64,000 US retail customers:
- Men's Email arm: 21,388 customers
- Women's Email arm: 21,307 customers
- Control Group (No Email comm): 21,305 customers
- Outcome: spend ($) in the 2 weeks after the campaign
- Covariates: recency, purchase history, gender catalogue, zip code, newbie status, channel
- Further feature engineering
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txtpython app.pyOpen your browser at http://localhost:8050.
First run: The app will pre-compute all causal models (~3–5 minutes for PyMC sampling, PSM bootstrap & uplift models) and cache results to
.cache/results.pkl. Subsequent starts load instantly from cache.
After changing any estimation logic in causal_utils.py, flip the USE_CACHE
flag at the top of that file to False and restart the app - the next run will
rebuild from scratch and overwrite .cache/results.pkl. Set it back to True
afterwards so subsequent starts (and the Plotly Cloud deployment) load instantly
from the pickle.
Selecting and applying the right method for the causal question: ATE via PSM and OLS, posterior distributions via Bayesian inference, and individual-level CATE via uplift modelling.
Every estimate is accompanied by an appropriate confidence interval: bootstrap CIs for PSM, HDI for Bayesian, and coefficient CIs for OLS.
Uplift modelling moves beyond average effects to identify which customers respond most, enabling targeted campaign optimisation.
Every tab includes a collapsible "Methodology & Assumptions" section written for both technical and non-technical audiences.
.
├── app.py # Dash app layout + callbacks
├── causal_utils.py # All causal estimation logic (PSM, Bayesian, Uplift, OLS)
├── requirements.txt
├── README.md
└── .cache/
└── results.pkl # Auto-generated on first run
