pymc-labs / pymc-marketing

Bayesian marketing toolbox in PyMC. Media Mix (MMM), customer lifetime value (CLV), buy-till-you-die (BTYD) models and more.
https://www.pymc-marketing.io/
Apache License 2.0
584 stars 137 forks source link

Investigate CLV model composition #276

Open ricardoV94 opened 1 year ago

ricardoV94 commented 1 year ago
with pm.Model() as m:
  hyper_priors = ...
  prior1, prior2 = distribution(hyper_priors)
  cohort1 = clv.ShiftedBetaGeo(data_cohort1, prior1)
  cohort2 = clv.ShiftedBetaGeo(data_cohort2, prior2)

clv.ComposeModel(...)

ColtAllen commented 12 months ago

Is this for hierarchical priors, or something more general?

ColtAllen commented 2 months ago

Looking back on this, I can confirm BetaGeoModel benefits from hyperpriors. The a and b parameters of the Beta dropout distribution seem to benefit from a hierarchical pooling approach:

https://mc-stan.org/users/documentation/case-studies/pool-binary-trials.html

Back when I was still maintaining the btyd library, this was the only way I could get the posterior mean values to mach the MLE estimates from lifetimes:

# Beta parameters.
a = pm.Deterministic("a", uniform_prior * pareto_prior)
b = pm.Deterministic("b", (1.0 - uniform_prior) * pareto_prior)