Customer Lifetime Value (CLV) basics

Machine Learning for Marketing in Python

Karolis Urbonas

Head of Analytics & Science, Amazon

What is CLV?

  • Measurement of customer value
  • Can be historical or predicted
  • Multiple approaches, depends on business type
  • Some methods are formula-based, some are predictive and distribution based
Machine Learning for Marketing in Python

Historical CLV

  • Sum revenue of all past transactions
  • Multiply by the profit margin
  • Alternatively - sum profit of all past transactions, if available
  • Challenge 1 - does not account for tenure, retention and churn
  • Challenge 2 - does not account for new customers and their future revenue

Historical CLV

Machine Learning for Marketing in Python

Basic CLV formula

  • Multiply average revenue with profit margin to get average profit
  • Multiply it with average customer lifespan

Basic CLV

Machine Learning for Marketing in Python

Granular CLV formula

  • Multiply average revenue per purchase with average frequency and with profit margin
  • Multiply it with average customer lifespan
  • Accounts for both average revenue per transaction and average frequency per period

Granular CLV

Machine Learning for Marketing in Python

Traditional CLV formula

  • Multiply average revenue with profit margin
  • Multiple average profit with the retention to churn rate
  • Churn can be derived from retention and equals 1 minus retention rate
  • Accounts for customer loyalty, most popular approach

Traditional CLV

Machine Learning for Marketing in Python

Introduction to transactions dataset

  • Online retail dataset
  • Transactions with spent, quantity and other values

Online Retail

Machine Learning for Marketing in Python

Introduction to cohorts dataset

  • Derived from online retail dataset
  • Assigned acquisition month
  • Pivot table with customer counts in subsequent months after acquisition
  • Will use it to calculate retention rate

Cohort counts

Machine Learning for Marketing in Python

Calculate monthly retention

Use first month values to calculate cohort sizes

cohort_sizes = cohort_counts.iloc[:,0]

Calculate retention by dividing monthly active users by their initial sizes and derive churn values

retention = cohort_counts.divide(cohort_sizes, axis=0)
churn = 1 - retention

Plot the retention values in a heatmap

sns.heatmap(retention, annot=True, vmin=0, vmax=0.5, cmap="YlGn")
Machine Learning for Marketing in Python

Retention table

Retention table

Machine Learning for Marketing in Python

Let's calculate some CLV metrics!

Machine Learning for Marketing in Python

Preparing Video For Download...