Back to demos

Case study

PROJECT / CASE STUDY

RFM Segmentation, CLV & Churn Risk

Segmentation → CLV → churn risk → experiment design

End-to-end customer analytics: RFM segmentation, 6-month CLV prediction (BG/NBD + Gamma-Gamma), churn risk modeling, and segment-level experiment sizing with power analysis.

What this demo does

Using two years of UK online retail transactions (UCI Online Retail II), this project cleans 805,549 transactions (5,878 customers, £17.74M revenue) and splits them into an 18-month calibration window and a 6-month holdout. RFM features from the calibration period feed a K-means segmentation into 5 business-readable groups (Champions, Loyal High-Value, At-Risk, Recent Low-Spend, Hibernating). A BG/NBD + Gamma-Gamma model (via `lifetimes`) predicts each customer's 6-month CLV, achieving 0.84 correlation with actual holdout revenue. A churn risk classifier (logistic regression, AUC 0.81) then beats the classic BTYD '1-P(alive)' heuristic, which scores AUC 0.44 — worse than random — because it can't tell a one-time buyer who'll return from one who won't. Finally, segment + CLV-at-risk + churn probability drive a per-segment intervention plan with A/B test sample sizing (power analysis) — only the At-Risk segment is large enough to test as designed; intervention effects are untested, so no ROI is estimated.

Use cases

CRM budget allocation and segment interventions

Combine segments, predicted CLV, and churn risk to identify the highest CLV-at-risk groups as the first to intervene on and test.

Segment-level A/B test design with power analysis

Compute required sample sizes per segment via power analysis, flagging which segments are large enough to test as designed and which need a longer window or pooling.

CLV / churn model selection

Compare a BTYD probabilistic baseline against ML classifiers for churn prediction, and understand why the classic heuristic fails for new/one-time buyers.