Help Center

Calculating CLV (Customer Lifetime Value) with AI Workbench

How to use the BlueConic customer data platform (CDP) to calculate customer lifetime value (CLV) using AI marketing modelsBlueConic provides a prebuilt AI marketing model you can use (without writing any code) to calculate customer lifetime value (CLV) for a segment of customer profiles. CLV metrics can be a valuable tool to identify, target, and grow customer transactions.

To run the AI model, you use a CLV notebook in AI Workbench, which calculates CLV based on customer order data. Before you run the CLV notebook, you first need to have customer order data uploaded to customers' BlueConic Timelines. The CLV notebooks use this order event information to calculate customer CLV metrics. 

Watch our video on running the CLV and RFM notebooks in the BlueConic AI Workbench: Configuring the RFM and CLV Notebooks in AI Workbench

Using the BlueConic AI Workbench to calculate CLV

The notebook code uses machine learning models that make predictions based on customer transactions stored in your profiles. Using transaction data from the default order event type, it builds a model and predicts the following values for a segment of customer profiles:

  • Probability alive: Measures the probability a customer has not yet churned and will make more purchases in the future.
  • Expected number of purchases: Shows how many purchases a customer will make during the prediction period based on their past purchasing behavior.
  • Customer lifetime value: Predicts the total revenue a customer will generate during a set prediction period based on that customer's past purchasing behavior.

Parameters the CLV notebook uses

The CLV notebook uses the following parameters to calculate the customer lifetime value:

  • CLV segment: Customer segment used to build the model. The model writes back the predicted values to the profiles in the segment you specify.
  • Prediction period: Number of months the notebook uses to predict the number of purchases and customer lifetime value.
  • Probability alive: Profile property where the notebook saves the predicted probability of whether a customer has churned. 
  • Expected number of purchases: Profile property where the notebook saves the number of purchases a profile is expected to make.
  • Customer lifetime value: Profile property where the notebook saves the predicted customer lifetime value for each profile in the segment.

You can optionally choose to use these parameters for the calculation:

  • Transaction data start date and Transaction data end date: These parameters provide the time frame used to filter historical transaction data the model uses to predict CLV.

Calculating CLV with AI models

The CLV notebook uses a Gamma-Gamma model to calculate the customer lifetime value or CLV, by multiplying the customer's expected number of purchases with the average transaction value for that customer. For details on the model and its calculations, open the Notebook editor window in the left-hand panel of your CLV notebook in BlueConic.

Training the CLV model on your data

The provided dataset is split into two random subsets: a training set, used to train the model, and a testing set, used to verify whether the model's predictions generalize well to data that hasn't been seen before.

Furthermore, since the model makes predictions about the future based on historical data, each set is split into a calibration period and a holdout period. The calibration period covers the first two-thirds of the period covered by the dataset; the holdout period covers the last third of the period.

Only the data from the training set's calibration period is used to train the model. Then, the test data from the calibration period is fed into the model and used to make predictions covering the holdout period. The predictions are then compared to the actual test data in the holdout period to assess how well the model generalizes across different customers and future time periods.

Adding a CLV notebook in BlueConic

  1. Select AI Workbench from the BlueConic navigation bar.
  2. Click Add notebook.
  3. A pop-up window appears. Scroll down to CLV notebook and click it.
    How to calculate customer lifetime value (CLV) with the customer data platform BlueConic using AI marketing models and Python notebooks
  4. The CLV notebook opens to the Parameters window.
    Note that if you have the correct permissions, the Notebook editor window is where you can view the notebook's Python code. It also contains detailed documentation about how the notebook works, and how the machine learning model uses datasets for training, calibrating, and running the predictions.

Setting the CLV model's parameters

The CLV notebook runs calculations and makes predictions for profiles in a customer segment you select in the Parameters tab. Note that the notebook requires that you have previously uploaded customer order data to these customers' BlueConic Timelines as order events.

  1. Select the Parameters tab in the left-hand panel of the CLV notebook window.
  2. For the CLV segment parameter, choose a customer segment whose profiles the notebook examines.
  3. Select a prediction period in months. The default period is 12 months.
    The prediction period counts the next X months from the date the notebook is run.
  4. (Optional) Select start date and end date (in UTC format) for the transaction data the model reads.
  5. The notebook writes its results to these profile properties:
    CLV Probability Alive, CLV Expected Number of Purchases, and CLV Customer Lifetime Value.
    How to use AI to calculate customer lifetime value CLV scores using BlueConic for AI Marketing
    (Note that you can customize these profile properties, but if you do, you'll need to update the Python code in the notebook tab as well.)

Running the CLV notebook

  1. To run the notebook, select Schedule and run history in the left panel. The Schedule and run page appears.
  2. In the metadata section at the top of the page, you can request email notifications each time the notebook runs or only for failed runs. For details, see: setting up email notifications for AI Workbench.
  3. Click Run now to run the CLV analysis manually.
  4. To schedule the import and export for a future date, activate Enable scheduling. Click the Settings icon How to schedule and run AI models without writing code using BlueConic. Select how to schedule the import by choosing an option from the drop-down list:
    • Every X minutes
    • Number of times per day
    • Days of the week
    • Days of the month
    • Weekday of the month

    Set a time for the import. Click OK

How to calculate CLV annd run AI models without writing Python code using the BlueConic customer data platform

Viewing your results

After running the notebook, you can view its output by clicking Preview. Scroll to the bottom of the notebook to see a graphical representation of the CLV analysis.

Tip: You can display the graph of the most recent run in an insight on a dashboard by adding a Notebook-All cells insight.

The notebook displays the following graphs to show results for the segment of profiles studied:

  • Frequency of repeat transactions
  • Expected number of repeat purchases per customer
  • Chart showing the probability the profile is still a 'live' or active customer
    The notebook stores "Probability alive" values for individual customer profiles in the CLV Probability Alive profile property.
  • Expected number of future transactions
    The notebook stores each customer's expected number of purchases in the CLV Expected Number of Purchases profile property.
  • Predicted customer lifetime value
    The notebook stores each customer's CLV score in the CLV Customer Lifetime Value profile property.
  • Distribution of customers with CLV across the segment of customers studied

How to measure CLV for customer lifetime value of a customer segment in BlueConic using AI Workbench



Was this article helpful?
0 out of 0 found this helpful