Notebooks

One lab per module, each opens in Google Colab

Start with the Module 0 notebook, then follow the modules in order. Most labs are in Python; where R has the reference implementation (CLVTools, CausalImpact and GeoLift, grf) the module has an R notebook too, and its page says why. Each notebook installs what it needs and loads its own data, so any lab opens cold, without the labs before it.

Module Notebook Language Runtime Open Time on Colab
0 · Pre-work: environment, warm-up and coding agents 00-setup-warmup Python Colab (Python runtime, CPU) Open in Colab 2 s on Colab (2026-10-16)
0 · Pre-work: environment, warm-up and coding agents 00-setup-warmup R Colab (R runtime, CPU) Open in Colab 2 s on Colab (2026-10-16)
1 · Transaction logs to customer-base analysis 01-customer-base-sql Python Colab (Python runtime, CPU) Open in Colab 11 s on Colab (2026-10-16)
2 · Buy-till-you-die models: BG/NBD and Pareto/NBD 02-btyd Python Colab (Python runtime, CPU) Open in Colab 3.2 min on Colab (2026-10-16)
3 · Covariates in CLVTools, and BTYD versus machine learning 03-clvtools-covariates R Colab (R runtime, CPU) Open in Colab 10 s on Colab (2026-10-16)
3 · Covariates in CLVTools, and BTYD versus machine learning 03-btyd-vs-ml Python Colab (Python runtime, CPU) Open in Colab 2.0 min on Colab (2026-10-16)
4 · Monetary value and dollar CLV 04-monetary-clv Python Colab (Python runtime, CPU) Open in Colab 5.7 min on Colab (2026-10-16)
5 · From CLV to decisions 05-clv-decisions Python Colab (Python runtime, CPU) Open in Colab 3.4 min on Colab (2026-10-16)
6 · Experiments done right 06-experiments Python Colab (Python runtime, CPU) Open in Colab 9 s on Colab (2026-10-16)
7 · Geo-experiments and quasi-experiments 07-synthetic-control-did Python Colab (Python runtime, CPU) Open in Colab 19 s on Colab (2026-10-16)
7 · Geo-experiments and quasi-experiments 07-causalimpact-geolift R Colab (R runtime, CPU) Open in Colab 70 s on Colab (2026-10-16)
8 · Bayesian marketing mix models 08-bayesian-mmm Python Colab (Python runtime, CPU) Open in Colab 3.7 min on Colab (2026-10-16)
9 · Calibrating and validating an MMM 09-mmm-calibration Python Colab (Python runtime, CPU) Open in Colab 10 min on Colab (2026-10-16)
9 · Calibrating and validating an MMM 09-robyn R Colab (R runtime, CPU) Open in Colab 3.1 min on Colab (2026-10-16)
10 · Budget allocation under uncertainty 10-budget-allocation Python Colab (Python runtime, CPU) Open in Colab 2.3 min on Colab (2026-10-16)
11 · Uplift and heterogeneous treatment effects 11-grf-causal-forest R Colab (R runtime, CPU) Open in Colab 75 s on Colab (2026-10-16)
11 · Uplift and heterogeneous treatment effects 11-uplift-econml Python Colab (Python runtime, CPU) Open in Colab 61 s on Colab (2026-10-16)
12 · Capstone: one decision pipeline for the retailer 12-capstone Python Colab (Python runtime, CPU) Open in Colab 4.1 min on Colab (2026-10-16)

Times come from run records of a worked, full-settings run of the whole notebook on Colab (readiness); laptop, Docker and CI times are never shown as Colab times.

Optional extensions

Self-paced modules beyond the five days (extensions). Each builds on core modules named on its page.

Module Notebook Language Runtime Open Time on Colab
13 · Messy real data: cleaning a real log for BTYD and spend models 13-messy-real-data Python Colab (Python runtime, CPU) Open in Colab 65 s on Colab (2026-10-16)
14 · Survival analysis for subscription churn 14-survival-churn Python Colab (Python runtime, CPU) Open in Colab 40 s on Colab (2026-10-16)
15 · Causal effects without an experiment: double machine learning 15-double-ml Python Colab (Python runtime, CPU) Open in Colab 2.3 min on Colab (2026-10-16)
16 · Multi-touch attribution: Markov chains, Shapley values and incrementality 16-multi-touch-attribution Python Colab (Python runtime, CPU) Open in Colab 23 s on Colab (2026-10-16)
17 · MMM with drifting effects and a Prophet baseline 17-mmm-time-varying Python Colab (Python runtime, CPU) Open in Colab 12 min on Colab (2026-10-16)
18 · Notifications: volume, targeting and a policy for the long run 18-notifications Python Colab (Python runtime, CPU) Open in Colab 38 s on Colab (2026-10-16)

Times on Colab come from run records, as for the core notebooks above.

Notebooks are stored without outputs. Work through the cells one at a time. Runtime → Run all stops at the first exercise you have not written, which is the point; to see a whole lab run, turn WORKED_EXAMPLE on in the harness cell first.

How the labs are laid out

Every notebook has the same cells, in this order:

  1. Header. The lab’s goals, its day and its time, and the Colab button.
  2. Install. Detects where it runs (Colab or a local machine) and installs the pinned package versions the workshop was tested with. If it asks you to restart the session, do so, then choose Run all again.
  3. Harness. Two switches. WORKED_EXAMPLE off (the default) keeps your own code; on, it runs every reference solution in place of your code. QUICK shortens sampling and uses a sample of the data; it never skips a checkpoint. In Python notebooks these are checkboxes; in R notebooks, plain variables (WORKED_EXAMPLE <- FALSE).
  4. Exercises, grouped in parts. Each exercise follows the rhythm:
    • Predict. A question to answer before you run anything.
    • Your code. A function stub that stops with TODO N until you write it.
    • Solution. Folded under the stub. Try the exercise first. Running the solution cell stores the reference; it does not overwrite your function.
    • Explain. Compare the result with your prediction, with a folded “why” underneath.
    • Checkpoint. Passes or fails, and says whose code it checked: yours or the reference. Where the data are synthetic, it compares your estimate with the known truth, using a named interval (for example a 94% highest density interval).
  5. Decision. The business decision the lab ends in, made from your own results.
  6. Stretch. An optional final section for those who finish early. Nothing later depends on it.
  7. Record. Lists which checkpoints passed on your own code and prints a run record: what ran, where, how long it took, and with which package versions.

When a checkpoint fails

The checkpoint says What it means What to do
TODO N is not written yet Your function still stops at its TODO, or you have not run its cell. Write the exercise, run its cell, then rerun the checkpoint.
A check failed on your code Your function ran but returned something wrong. Read the message above it: it names what to look at. Fix the function and rerun both cells.
It failed on the reference solution A problem with the lab or the runtime, not with your code. Tell the instructor.

Stuck on exercise N? Run its folded solution cell, then workshop.use_reference(N) in Python or use_reference(N) in R, and carry on with the reference. Rerun your own cell to switch back.

An error in the install or harness cell is a setup problem, not an unfinished exercise: see Setup and the FAQ.