customer_lifetime_value#

pymc_marketing.clv.utils.customer_lifetime_value(transaction_model, data, future_t=12, discount_rate=0.0, time_unit='D')[source]#

Compute customer lifetime value.

Compute the average lifetime value for a group of one or more customers and apply a discount rate for net present value estimations. Note future_t is measured in months regardless of time_unit specified.

Adapted from lifetimes package CamDavidsonPilon/lifetimes

Parameters:
transaction_modelCLVModel

Predictive model for future transactions. BetaGeoModel and ParetoNBDModel are currently supported.

dataDataFrame

DataFrame containing the following columns:

  • customer_id: Unique customer identifier

  • frequency: Number of repeat purchases observed for each customer

  • recency: Time between the first and the last purchase

  • T: Time between the first purchase and the end of the observation period

  • future_spend: Predicted monetary values for each customer

future_tint, optional

The lifetime expected for the user in months. Default: 12

discount_ratefloat, optional

The monthly adjusted discount rate. Default: 0.00

time_unitstr, 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:
xarray

DataArray containing estimated customer lifetime values