ParetoNBDModel.expected_purchase_probability#

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

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 [4], and lifetimes package: CamDavidsonPilon/lifetimes

Parameters:
  • data (pd.DataFrame) –

    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: Number of time periods to predict expected purchases.

    • n_purchases: Number of purchases to predict probability for.

      Currently restricted to the same number for all customers.

    • covariates: Purchase and dropout covariate columns if original model had any.

    If not provided, the method will use the fit dataset.

  • n_purchases (int, optional) – Number of purchases predicted. Not needed if data parameter is provided with a n_purchases column.

  • future_t (array_like, optional) – Time periods over which the probability should be estimated. Not needed if data parameter is provided with a future_t column.

Return type:

DataArray

References