P-002 · 2025 · Team project

Hierarchical Bayesian Pareto/NBD customer modelling

Replication of Abe (2009): a hierarchical Bayesian Pareto/NBD model fitted by MCMC on CDNOW to forecast customer activity, lifetime and repeat purchases.

PythonBayesian modellingMCMCCDNOW

The model behind each customer

CDNOW purchase histories: frequency, recency and customer age
Purchase processPoisson purchases at a customer-specific rate λ
Dropout processExponential lifetime with a customer-specific rate μ
Hierarchical priorλ and μ drawn jointly, with and without a sales covariate

Posterior estimated by MCMC; calibration and validation compared

Expected lifetime, survival probability and forecast transactions
A replication of Abe (2009): the hierarchy lets purchase and dropout rates correlate across customers.

The question

In non-contractual retail, a company never sees a customer leave: they simply stop buying. The Pareto/NBD model handles this with two hidden processes per customer, how often they buy while active and when they drop out. Abe (2009) adds a hierarchical prior, so purchase and dropout rates can be correlated and linked to customer characteristics. Our team replicated that model on the public CDNOW dataset.

Approach

The workflow turns the CDNOW transaction log into one summary per customer: the number of repeat purchases, the time of the last purchase and the length of observation. It then fits the standard Pareto/NBD and two hierarchical versions by MCMC: HB M1 without covariates and HB M2 with the initial purchase amount as a covariate. Each model is checked in a calibration period and a later validation period, per customer and in aggregate.

Results

For aggregate weekly purchases, the standard Pareto/NBD tracked the data most closely, with a validation MAPE of 6.54% against 11.17% for HB M1 and 10.16% for HB M2. It also had the highest customer-level validation correlation (0.63 against 0.56). The covariate improved HB M2 over HB M1 in validation, and the estimated correlation between purchase and dropout rates stayed close to zero. For every customer the models report expected lifetime, survival probability and expected transactions.

My role and limits

I worked on implementing and validating the hierarchical model as part of the team. This is a replication on one benchmark dataset of 2,357 customers, so the results show how the models behave on CDNOW, not how they would perform for a production customer base. My later TabPFN-3.5 benchmark revisits both models on larger data.

Aggregate forecast error: weekly repeat purchases

Pareto/NBDHB M1HB M2
036912Pareto/NBD, Calibration: 5.48%5.5HB M1, Calibration: 7.10%7.1HB M2, Calibration: 7.17%7.2CalibrationPareto/NBD, Validation: 6.54%6.5HB M1, Validation: 11.17%11.2HB M2, Validation: 10.16%10.2ValidationPareto/NBD, Pooled: 4.07%4.1HB M1, Pooled: 6.81%6.8HB M2, Pooled: 6.54%6.5PooledMAPE, % (lower is better)
Weekly time-series MAPE on CDNOW from the repository’s model-fit table. The standard Pareto/NBD tracks aggregate purchases most closely, while the sales covariate (HB M2) lowers validation error relative to HB M1.

View public code and documentation on GitHub ↗

Timur Salakhetdinov ·