UCI Online Retail II · Dec 2009 – Dec 2011 · 36,639 orders
Which customers to call, and how many are worth calling.
Customer analytics on 802,712 real transactions from a UK gift-ware
retailer. K-means RFM segmentation, a churn model validated on held-out customers,
and market-basket rules. The retention question is answered with a
precision@k curve and a cost model, not a threshold picked because it was round.
All 25 months in the dataset. The two November peaks are the
pre-Christmas wholesale run — this is a gift-ware supplier, so demand is seasonal
and the churn window below sits deliberately after the 2011 peak.
Where the revenue comes from
Revenue outside the UK
The UK alone is 83.9% of revenue
(£14.6M). Plotting it beside the others on one linear axis flattens every
remaining bar to nothing, so its share is stated here and the chart answers the
question that is actually open: who else matters.
Outside the UK, EIRE and the Netherlands lead — both
wholesale-heavy, low-order-count, high-value markets.
Segment concentration
K-means on log-scaled Recency, Frequency and Monetary, K=4
— chosen for business interpretability after inspecting inertia and silhouette
across K=2–8, not because the diagnostics forced it.
Champions are 22% of customers and
73% of revenue. Losing one is not the same event as losing an
average customer, which is why the retention model is ranked by value, not just risk.
Who to contact — and how many
Precision@k: how pure is the call list?
Customers ranked by predicted churn probability, scored
out-of-sample only (1,047 held-out customers, model refit on the
training split). Precision is the share of the top k who genuinely did not return.
The top 100 are 90% real churners. By 500 that falls to
78%, and it converges on the 55.3% base rate as the list grows — which is
what ranking is supposed to do.
Holdout AUC 0.796 against a 55.3% base rate. The earlier version of
this project reported £1.46M "revenue at risk" by scoring every customer with a model
that had trained on 80% of them, then summing revenue they had already spent. Both
halves of that were wrong, so the figure is retired rather than restated.
Recoverable revenue by list size
Forward revenue — what a saved customer would be expected to
spend after the cutoff, estimated from the median of retained customers in the
same segment. A churned customer's own forward revenue is zero by definition.
At a £3 contact cost, cost is not the binding
constraint — median forward value is ~176× the contact cost, so expected
profit keeps rising with reach. Capacity is the constraint, so the question
becomes how many calls the team can actually make.
Market-basket rules by lift
Apriori association rules. Lift is how much more often the pair
co-occurs than if the two items were independent.
Top pair lifts 24× at
80% confidence — the Regency teacup set. Clean, real, and
directly actionable as a cross-sell prompt.
Method & limits
How the churn label avoids leakage
The ordering matters more than the model.
Features are built only from transactions before
1 Sep 2011. The label is whether the customer purchased in the Sep–Dec 2011 window that
follows. So no feature can contain information from the period it predicts.
Evaluation is a random 80/20 split across customers. Calling that
a "time-based holdout" would be wrong — the label is forward-looking, the
split is not. A temporal evaluation split is the honest next step.
Known limitations
Stated, not buried.
Recoverable revenue is an estimate, not an observation: it uses the
median forward spend of retained customers in the same segment as a proxy for what a
saved churner would spend.
The save rate is assumed, not measured. Only a holdout campaign with
a control group could establish it.
K=4 is a judgement call. Silhouette scores across K=2–8 are
computed but not reported, so a reader cannot check whether a better K was overridden.
Uplift, not risk, is the right target. Ranking by churn probability
finds customers likely to leave, not customers a campaign could change.
Published figures come from re-running the pipeline against the canonical
UCI file. They differ from an earlier version of this page (805,549 rows / 38 countries /
AUC 0.824), whose numbers were typed into the markup and could not be reproduced from the
public dataset. The ones here are generated at build time.