In this recipe, we will learn how to compute lifetime values and the value a customer provides to this company. This is important for the marketing budget – for example, in lead acquisition or ads spent based on customer segments. We'll do this by modeling separately changes in customer purchase patterns over time and purchase values.
We'll need the lifetimes package for this recipe. Let's install it as shown in the following code:
pip install lifetimes
Now we can get started.
How to do it...
Datasets used for customer lifetime values can be either transactional or summarized by the customer.
The summary data should include the following statistics:
- T: The transaction period; the elapsed time since the first purchase by the customer
- Frequency: The number of purchases by a customer within the observation period
- Monetary value: The average value of purchases
- Recency: The age of the customer at the time of the last...