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
715 stars 201 forks source link

`sample_prior_predictive` for CLV models #1155

Open wd60622 opened 3 weeks ago

wd60622 commented 3 weeks ago

Is this a workflow that you use @ColtAllen?

This gets inherited from the ModelBuilder (and shows in the docs) but isn't actually implemented, right?

import pandas as pd
from pymc_marketing import clv

data_url = "https://raw.githubusercontent.com/pymc-labs/pymc-marketing/main/data/clv_quickstart.csv"
data = pd.read_csv(data_url)
data["customer_id"] = data.index

beta_geo_model = clv.BetaGeoModel(data=data)
try:
    beta_geo_model.sample_prior_predictive()  
except TypeError:
    ...
ColtAllen commented 3 weeks ago

I'm actually working on a PR right now that involves plotting prior predictives. This can't be done with the ModelBuilder methods due to the X-Y convention, so I've been using the following approach:

with clv_model.model:
    prior_idata = pymc.sample_prior_predictive()
wd60622 commented 3 weeks ago

Yup, understand that limitation. I plan to rework that in the near future