BG/NBD Model in PyMC
See original GitHub issueHey! I have recently drafted a BG/NBD model in PyMC, see https://juanitorduz.github.io/bg_nbd_pymc/
In particular I have also added the possibility to add time-invariant regressors (even though the sampler and/or model parametrisation need some improvements). Other models from the lifetimes
package can be ported to PyMC in a similar way (because the lifetimes
package has all the log-likelihood functions written in numpy
already).
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Bayesian Customer Lifetime Values Modeling using PyMC3
Implementing BG-NBD, a probabilistic hierarchical model, using PyMC3 to analyze customer purchase behavior. Source: Unsplash. Customer lifetime ...
Read more >BG/NBD (Beta-Geometric/Negative Binomial) Model for ...
Hi, I'm trying to implement the BG/NBD model from Fader et al 2005 (“Counting Your Customers” the Easy Way: An Alternative to the...
Read more >Customer Life Time Value Prediction by Using BG-NBD ...
BG-NBD Model will model each customer's purchase behaviours' distribution and will predict the expected number of transactions for each customer ...
Read more >Why do Pareto/NBD models require custom likelihood ...
A) A customer not returning is directly modeled by the Geometric process. B) The model integrates out each customer's parameters using their ...
Read more >ColtAllen/btyd: Buy Till You Die and Customer ... - GitHub
Buy Till You Die and Customer Lifetime Value statistical models in Python. ... and Bayesian PyMC model implementations are now in Beta.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That sounds very exiting! Let me know if you need som input or want me to test some of the ongoing features. As a side remark, I also did a small re-write in
pymc
for the gamma-gamma model, see https://juanitorduz.github.io/gamma_gamma_pymc/Hey @juanitorduz ,
This is great! I really hope you can join the Zoom kickoff call for this project next Sunday. Information to join is in a Discussion post in this repo as well as here:
https://github.com/CamDavidsonPilon/lifetimes/issues/414#issuecomment-1073247582
I’ve been working on a BG/NBD model as well, but will be experimenting with ADVI or SVGD for inference because MCMC training can go on for days, compared to minutes with ADVI. However, MCMC is also the only way to derive the true posterior distribution (rather than an approximation as is the case with ADVI or SVGD). A more performant option for MCMC may be Stan, which
prophet
uses for inference of its time series model parameters. @alexpavlakis wrote a script in Stan for the Gamma-Gamma model, but I haven’t tested it yet inCmndStanPy
.As you mentioned, the tricky thing about these algorithms is choosing an appropriate prior, and my goal is to make this library as user-friendly as possible. Fortunately in the case of the Pareto/NBD model, there is a research paper on this very topic:
Worth the effort? Comparison of different MCMC algorithms for estimating the Pareto/NBD model
I’ve saved several research papers on covariates and other modeling alternatives and will be posting links to the README soon. None of them are pay-walled, but to be safe I can also look into uploading my saved copies to the repo. One of these papers even covers a Pareto/NBD model with time-varying covariates, but it is immensely more compute-intensive than the standard Pareto/NBD and only performs significantly better for customers with lifetimes of 3 years or more.