Unfortunately, many businesses calculate CLV using historical customer behavior without accounting for variation in that behavior. For example, a customer who buys several expensive items at once might be assigned a higher value than a customer who consistently buys moderately priced items โ even if he or she never buys from the business again after the initial purchase.
There are two classes of business contexts that influence how a data scientist should go about modeling customer lifetime value:
-
Whether purchases are discrete or continuous.
-
Whether the setting is contractual or non-contractual.
Discrete purchases occur at fixed periods or frequencies, whereas continuous purchases occur at any time. Whether purchases are contractual or not determines whether customer churn is visible or must be inferred; This example is for non-contractual, but you can hook up AutoML for Customer Churn project, here, for a contractual business.
CLV models can provide lots of actionable information, like the probability that a customer will churn or a population-level prediction of how many orders customers will be placing at a given time. These insights are critical for data-driven retention measures and sales forecasts, respectively.
Additional reading:
Pandas: $ sudo pip install pandas
numpy: $ sudo pip install numpy
scipy: $ sudo pip install scipy
matplotlib:
$ sudo apt-get install libfreetype6-dev libpng-dev
$ sudo pip install matplotlib
seaborn: $ sudo pip install seaborn
jupyter notebook: $ sudo apt-get -y install ipython ipython-notebook
$ sudo -H pip install jupyter
lifetimes: $ sudo pip install lifetimes
- Data set can be download from this link
- There is no need to download dataset because it is already downloaded.
- Path of dataset is
./input_data/
Run the code given in ipython notebook customer_lifetime_value.ipynb
Boilerplate code credits for this code go to Susan Li, I just made it more accessible to a contractual lifetime value analysis which can be coupled with my AutoML for Customer Churn project.