Customer Lifetime Value Prediction with PyMC-Marketing

Jimmy Hajime Takeda10 Nov 2023

Problem

Marketing teams usually optimize cost per acquisition (CPA) and ignore what a customer is worth later. The simple CLV formula (order value × orders per year × years of loyalty) uses one average for everyone, ignores different join dates, and cannot say whether a retail customer who stopped buying has churned. The result is overspending on one-time buyers and underspending on repeat buyers.

Example from the article: A fashion shop pays 10 USD to acquire a college student and 20 USD for a working professional, and the first order is about 100 USD for both. Students rarely return (about 100 USD in total), professionals reach about 400 USD.

Solution in brief

Fit a Buy-Till-You-Die (BTYD) model on transaction data only. BG/NBD predicts how many purchases each customer will still make and the probability that the customer is still active. Gamma-Gamma predicts average order value. Their product, discounted over time, is the CLV of each customer, which can then be averaged by segment to set acquisition budgets.

Questions this case answers
  • How to estimate the future value of each customer from purchase history alone when churn is never observed and customers have different tenure
  • How to allocate acquisition budget across segments by long-term value instead of first-purchase cost
  • How to predict customer lifetime value from nothing but transaction history?
  • How to tell whether a non-subscription customer is still active or has silently churned?

Tools and methods

  • BG/NBD model — per-customer purchase frequency and probability of being alive
  • Gamma-Gamma model — per-customer expected average order value
  • PyMC-Marketing — Python library that implements both models on top of PyMC
  • MCMC — fits the Bayesian models; convergence is checked with r_hat
  • RFM-T summary — recency, frequency, monetary value and tenure per customer, the model input
Continue reading — it's free

Google or a one-time email code. No password.