ParetoNBDModel.expected_purchase_probability#

ParetoNBDModel.expected_purchase_probability(data=None, *, n_purchases=None, future_t=None)[source]#

Compute expected probability of n_purchases over future_t time periods.

Estimate probability of n_purchases over future_t time periods, given an individual customer’s current frequency, recency, and T.

Adapted from equation (16) in Bruce Hardie’s notes [1], and lifetimes package: CamDavidsonPilon/lifetimes

Parameters:
dataDataFrame

Optional dataframe containing the following columns:

  • customer_id: Unique customer identifier

  • frequency: Number of repeat purchases

  • recency: Time between the first and the last purchase

  • T: Time between the first purchase and the end of the observation period. Model assumptions require T >= recency

  • future_t: Optional column for future_t parametrization.

  • n_purchases: Optional column for n_purchases parametrization. Currently restricted to the same number for all customers.

  • All covariate columns specified when model was initialized.

If not provided, predictions will be ran with data used to fit model.

future_tarray_like

Number of time periods to predict expected purchases. Not required if data Dataframe contains a future_t column.

n_purchasesint

Number of purchases predicted. Not required if data Dataframe contains an n_purchases column.

future_tarray_like

Time periods over which the probability should be estimated. Not required if data Dataframe contains an n_purchases column.

References

[1]

Fader, Peter & G. S. Hardie, Bruce (2014). “Deriving the Conditional PMF of the Pareto/NBD Model.” https://www.brucehardie.com/notes/028/pareto_nbd_conditional_pmf.pdf