Machine Learning for Growth Marketing
Customers, incrementality, budgets and notifications, with uncertainty
Genial Labs · A hands-on workshop
Machine Learning for Growth Marketing
Customers, incrementality, budgets and notifications, with uncertainty
Five days from a raw transaction log to a budget and a target list. You find out who your customers are and who is still active, what each one is worth, whether the marketing caused the sales, where the next dollar should go and whom to send an offer. Every method is first fitted to synthetic data with a known answer, so you see whether it recovers the truth before you trust it on real data.
5 days 12 modules + optional pre-work 18 lab notebooks (13 Python, 5 R) 70 hands-on exercises 45–55 min briefings, 50–55 min labs +6 optional extension modules
As of 2026-10-16, the core workshop (pre-work and Days 1–5): ready to teach. 18 of its 18 notebooks have a current, passing, worked, full-settings run of the whole notebook on Colab. 0 have passed on another machine (0 with full settings), and 18 on CI. Optional extensions (Modules 13–18), not part of that verdict: 6 of 6 notebooks have a current, passing Colab run; 0 have passed on another machine and 6 on CI. What has run, where.
The five days
Each day answers one question, and each module ends in a business decision. A module is a short briefing, a hands-on lab in Google Colab and a debrief.
Before Day 1
Is my environment ready, and can I count purchases per customer in pandas, SQL or dplyr?
Module 0, optional
Day 1
Who are our customers, and who is still with us?
Modules 1–3 · 09:00–16:20
Day 2
What is a customer worth, in money, with uncertainty?
Modules 4–5 · 09:00–16:00
Day 5
Whom should we target, and what is the plan for next quarter?
Modules 11–12 · 09:00–17:00
Extensions
What changes when the data are messy, observational, path-shaped or drifting, or when the channel is one you own and can fire every day?
Modules 13–18, optional
See the full schedule or go straight to the notebooks. Before Day 1, Module 0 · Pre-work: environment, warm-up and coding agents is optional pre-work: it checks that Colab runs for you and warms up the SQL and data-frame skills Day 1 uses. After the week, the optional extensions go further, on your own or in a custom schedule.
The path
Each step fixes a failure of the one before it. The same retailer and its data come back from module to module, so each improvement is measured on the same customers, not asserted.
Before Day 1 · Pre-work
0
Pre-work: environment, warm-up and coding agents Optional
Check that your environment runs, turn a raw transaction log into a customer table in DuckDB SQL and in pandas (or dplyr), and see how to check code that a coding agent wrote.
1
Transaction logs to customer-base analysis
Turn raw transaction logs into a customer table with DuckDB window functions, draw cohort retention curves, and see why churn is never observed when customers can leave without telling you.
2
Buy-till-you-die models: BG/NBD and Pareto/NBD
Model purchasing and silent dropout with BG/NBD and Pareto/NBD, check that the fit recovers known parameters, forecast a holdout period, and turn the probability a customer is alive into a retargeting rule.
3
Covariates in CLVTools, and BTYD versus machine learning
Add the acquisition channel as a covariate to the Pareto/NBD in CLVTools and recover the true channel effects, then run a fair holdout comparison of BTYD against gradient boosting.
Day 2 · What a customer is worth
4
Add a Gamma-Gamma spend model after checking that spend is independent of purchase frequency, compute discounted CLV with its uncertainty, test how it moves with horizon and discount rate, and handle the contractual case with the shifted-beta-geometric model.
5
Turn posterior CLV into decisions: the most we can pay to acquire a customer in each channel, segment value with credible intervals, the break-even effect of a retention campaign and scores written to a warehouse table, with the numbers for a one-page CFO memo that you write in the afternoon clinic.
6
Design and read randomized experiments correctly: power and minimum detectable effect, sample-ratio checks, why peeking inflates false positives, CUPED variance reduction, delta-method standard errors for ratio metrics, and why attribution is not incrementality.
7
Geo-experiments and quasi-experiments
Estimate the lift of a regional campaign with difference-in-differences and synthetic control written from scratch, test them with placebos and power simulations on a geo panel with known lift, compare with CausalImpact in R, and check the method on California’s Proposition 99.
Day 4 · Where the next dollar goes
8
Build a Bayesian marketing mix model (MMM) with adstock, saturation and seasonality in PyMC-Marketing, set priors from spend shares, check priors and posterior against the data, and report ROAS per channel with intervals against the known truth.
9
Calibrating and validating an MMM
Feed geo-test results into the MMM as extra likelihood terms, validate it with time-slice cross-validation and parameter stability, and see what an MMM cannot identify, such as a channel whose spend follows demand.
10
Budget allocation under uncertainty
Turn response curves into a budget: write a constrained SLSQP allocator, compare it with PyMC-Marketing’s optimizer, add minimum and maximum spend per channel, make the allocation robust to posterior uncertainty, and credit channels for the long-run value of the customers they bring.
Day 5 · Targeting and the plan
11
Uplift and heterogeneous treatment effects
Estimate who responds to an email offer because of it, with causal forests (grf in R, EconML in Python) and meta-learners, evaluate targeting rules with Qini curves and RATE on held-out data, and target only where the expected incremental margin exceeds the offer cost.
12
Capstone: one decision pipeline for the retailer
In pairs, run the whole pipeline on the synthetic retailer (CLV by channel, a geo-test readout, a calibrated MMM, a budget allocation and uplift targeting) and present a five-slide decision brief with its uncertainty.
Beyond the week
Optional, self-paced extensions, outside the five days. Each starts from the core modules named under it, not from the capstone.
Extensions · Beyond the core week
13
Messy real data: cleaning a real log for BTYD and spend models Optional
Build a cleaning pipeline that reproduces a known clean answer on a deliberately dirtied copy of the synthetic retailer, measure how much each data error moves BG/NBD, Gamma-Gamma and individual customer scores, cap extreme orders, and apply the same pipeline to UCI Online Retail II to choose whom to contact.
14
Survival analysis for subscription churn Optional
Estimate subscriber retention from right-censored data with Kaplan-Meier, see where it stops and Module 4’s sBG model has to take over, adjust a confounded comparison with a Cox proportional-hazards model, find an effect that fades with tenure, and turn the effect of onboarding into months of subscription and dollars.
15
Causal effects without an experiment: double machine learning Optional
Estimate how much installing the app, which customers chose for themselves, changed their next 26 weeks of spend: see a naive comparison and a regression with controls miss the known truth, write double machine learning with cross-fitting by hand, find out whose effect the estimate describes, then reproduce it with EconML’s LinearDML and check the method against a randomized benchmark built from the Hillstrom experiment.
16
Multi-touch attribution: Markov chains, Shapley values and incrementality Optional
Credit conversions to channels along user journeys with last-click, first-click, linear, a Markov-chain removal effect and Shapley values, then score every method against the conversions each channel truly causes in a simulation where some channels reach users who were likely to buy anyway.
17
MMM with drifting effects and a Prophet baseline Optional
Find and model a channel whose effect per dollar fades (ad fatigue): show that a static MMM reports its all-period average as if it held today, detect the drift from the static model’s residuals, estimate the decline with a time-varying MMM, and test against the truth what a Prophet baseline fitted to sales does to channel ROAS.
18
Notifications: volume, targeting and a policy for the long run Optional
Measure what one push notification does the same day with a randomized send experiment, then what a cadence does over a quarter with a volume experiment (opens say daily, 90-day margin says three a week, and daily sends lose half the reachable base), target sends with an uplift rule that charges each send its opt-out risk, run a contextual bandit with and without a penalty for opt-outs, fit a send-or-skip policy by value iteration on the volume log with a per-send penalty, and choose a policy by 90-day margin under a reachable-base guardrail.
How the parts connect
The methods are not a list of separate techniques. Each one produces an input that a later decision needs.
Read each lane from top to bottom, starting in the middle. Every lane ends in a decision.
- Customer value (middle). Transaction logs become customer lifetime value (CLV): buy-till-you-die (BTYD) models estimate how often each customer buys and whether they are still active, and the Gamma-Gamma model estimates how much they spend.
- Media and lift (left). Geo tests measure what a campaign added against a counterfactual. That measured lift then constrains the Bayesian marketing mix model (MMM), whose response curves drive the budget allocator.
- Targeting (right). Randomized experiments train uplift models, which estimate who responds to an offer, not just who buys.
CLV connects the lanes. It is the long-run value the allocator maximizes and the margin that decides whether an offer pays for itself. The capstone on Day 5 runs the whole chain for one retailer.
What you will be able to do
- Turn a raw transaction log into a customer table and cohorts with SQL in DuckDB.
- Fit BG/NBD and Pareto/NBD models, check that they recover known parameters, and say which customers are probably still active.
- Add customer covariates with CLVTools in R, and compare the probabilistic models with gradient boosting on held-out data.
- Estimate customer lifetime value in dollars with an interval, and turn it into acquisition cost caps and retention break-even points.
- Plan and analyze experiments: power and minimum detectable effect, sample ratio mismatch, peeking, CUPED.
- Estimate the lift of a geo test with synthetic control, difference-in-differences and CausalImpact, and check it with placebo tests.
- Fit a Bayesian marketing mix model, calibrate it with lift tests, and validate it out of time.
- Allocate a budget across channels under uncertainty, with constraints and a CLV-weighted objective.
- Estimate uplift with causal forests and meta-learners, evaluate it with Qini curves, and target where the margin exceeds the cost of the offer.
Who it is for
Marketing analysts, data scientists and analytics engineers who know Python or R basics, linear and logistic regression, and SQL.
You do not need a background in econometrics or Bayesian statistics: each model is introduced from what a practitioner needs to use it and check it. Not sure you are ready? The 15-minute entry check tells you, area by area, whether to review anything and what to read.
You need a Google account for Colab and a current browser on a laptop. Labs run in Colab in Python or R; a local Docker image and documented AWS options are on the Setup page.
How each module works
Each module is a briefing that motivates and derives the method, a lab in which you build it in a Colab notebook, and a short debrief in which the room compares results and states the decision. The times for each module are on the schedule.
Every lab follows one rhythm:
- Predict what a cell will show before you run it, and write it down.
- Run it.
- Explain the result, especially where it differs from your prediction.
- Check your work against a checkpoint that passes or fails, often against the known truth of the synthetic data.
Each exercise has its solution folded directly beneath it, for when you are stuck. Each lab ends with its business decision and an optional stretch section for those who finish early.
Where to start
- Take the entry check. Fifteen minutes, before the workshop, to see what to review.
- Set up. Open a lab in Colab and run the setup check; no install needed on your laptop.
- Do the pre-work. Optional Module 0: the environment check and a short SQL and data-frame warm-up.
Everything that has run, and where, is on the readiness page. The reading list is on References.