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 oftime_unit
specified.Adapted from lifetimes package CamDavidsonPilon/lifetimes
- Parameters:
- transaction_model
CLVModel
Predictive model for future transactions.
BetaGeoModel
andParetoNBDModel
are currently supported.- data
DataFrame
DataFrame containing the following columns:
customer_id
: Unique customer identifierfrequency
: Number of repeat purchases observed for each customerrecency
: Time between the first and the last purchaseT
: Time between the first purchase and the end of the observation periodfuture_spend
: Predicted monetary values for each customer
- future_t
int
, optional The lifetime expected for the user in months. Default: 12
- discount_rate
float
, optional The monthly adjusted discount rate. Default: 0.00
- time_unit
str
, 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”.
- transaction_model
- Returns:
xarray
DataArray containing estimated customer lifetime values