customer_lifetime_value#

pymc_marketing.clv.utils.customer_lifetime_value(transaction_model, customer_id, frequency, recency, T, monetary_value, time=12, discount_rate=0.01, freq='D')[source]#

Compute the average lifetime value for a group of one or more customers. This method computes the average lifetime value for a group of one or more customers. It also applies Discounted Cash Flow.

Adapted from lifetimes package CamDavidsonPilon/lifetimes

Parameters:
  • transaction_model (CLVModel) – The model to predict future transactions

  • customer_id (array_like) – Customer unique identifiers. Must not repeat.

  • frequency (array_like) – The frequency vector of customers’ purchases (denoted x in literature).

  • recency (array_like) – The recency vector of customers’ purchases (denoted t_x in literature).

  • T (array_like) – The vector of customers’ age (time since first purchase)

  • monetary_value (array_like) – The monetary value vector of customer’s purchases (denoted m in literature).

  • time (int, optional) – The lifetime expected for the user in months. Default: 12

  • discount_rate (float, optional) – The monthly adjusted discount rate. Default: 0.01

  • freq (string, optional) – Unit of time of the purchase history. Defaults to “D” for daily. Other options are “W” (weekly), “M” (monthly), and “H” (hourly). Example: If your dataset contains information about weekly purchases, you should use “W”.

Returns:

DataArray with the estimated customer lifetime values

Return type:

xarray