← All case studies

Research · open data

E-commerce retention model on 500,000+ transactions

Which customers come back? A retention model on a public online-retail dataset that beats the benchmark by 9 points of AUC.

The task

Predict which customers of an online retailer will buy again, and turn the answer into budget advice: how much to spend on winning new customers versus keeping current ones.

The data

UCI Online Retail II: 500,000+ real transactions of a UK online gift retailer, customers in 38 countries, December 2010 – December 2011. Public dataset, CC BY 4.0.

The approach

  • Cleaned cancellations, returns and service lines; built average order value and RFM features (recency, frequency, monetary) per customer.
  • Tested the difference between customer groups for significance: Welch's t-test, t = 15.42, p < 0.001.
  • Trained a Random Forest classifier for retention and compared it with a 0.70 ROC-AUC benchmark.
  • Turned model output into recommendations on acquisition budget and retention offers.

Results in numbers

0.79ROC-AUC, against a 0.70 benchmark
77%model accuracy
500K+transactions, 38 countries
t = 15.42Welch's t-test, p < 0.001
Share of revenue by RFM segment, %Champions are 14.6% of customers and bring 49% of revenue.
Champions49.0%
Loyal26.0%
Can't lose2.0%
At risk7.3%
Potential loyalists5.6%
Need attention1.8%
New0.2%
Promising0.3%
About to sleep1.9%
Hibernating5.9%

Source: UCI Online Retail II (Chen, 2019), sheet Year 2010-2011, CC BY 4.0; our calculation

Customers buying again, % of the first-month cohortMonths after the first purchase. December 2010 cohort against the size-weighted average of all cohorts.
  • Dec 2010 cohort
  • All cohorts, average
0%
10%
20%
30%
40%
35%31%
M1Dec 2010 cohort: 37%All cohorts, average: 24%
M2Dec 2010 cohort: 32%All cohorts, average: 25%
M3Dec 2010 cohort: 38%All cohorts, average: 27%
M4Dec 2010 cohort: 36%All cohorts, average: 28%
M5Dec 2010 cohort: 40%All cohorts, average: 29%
M6Dec 2010 cohort: 36%All cohorts, average: 29%
M7Dec 2010 cohort: 35%All cohorts, average: 29%
M8Dec 2010 cohort: 35%All cohorts, average: 31%
M1M3M5M7M8

Source: UCI Online Retail II (Chen, 2019), sheet Year 2010-2011, CC BY 4.0; our calculation

Charts are recalculated on the same public dataset for our RFM segmentation article; the model metrics above are from the original project.

Where this applies

In a typical online store a minority of customers brings most of the money. We find them in your order data, track whether they come back, and put the numbers that matter on one weekly dashboard.

Retail & e-commerce analytics →

Read the method

The full walk-through on our blog →

Have a similar question about your data?

Start with a free 20-minute call. You get a written quote with fixed scope and price.

Book a 20-min call

More case studies: Running retail on numbers: 12 years of pricing, purchasing and stock · Staking fund portfolio: the range of outcomes, not one forecast