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
718 stars 203 forks source link

Different Priors for Individual control or Media Variables #1049

Open shubhambooking2 opened 2 months ago

shubhambooking2 commented 2 months ago

Hi Team,

I wanted to understand if there is a way through which i can give different priors to different control variables. For a set of controls i want to have a HalfNormal Distribution where as for another set of control varaibles i need Normal Distribution. At the moment its a bit unclear how can i achieve this.

Similary i want to do it for Adstock parameters where a specific set of media channels have a different adstock prior as compared to other set of the media channel.

Any input for this would be helpful

wd60622 commented 2 months ago

Hi @shubhambooking2

Check out this discussion: https://github.com/pymc-labs/pymc-marketing/discussions/1045

There are some limitation based on what distributions you would like be use. However, you can get away with a TruncatedNormal distribution

wd60622 commented 1 month ago

Hi @shubhambooking2, was that resource any help to you? If not, please let me know and I can try to help you further.

shubhambooking commented 1 month ago

I tried with TruncatedNormal distribution , however my model fails to converge post using truncated normal distribution. Any suggestions to fix this or to achieve the originial need of having prior for a subset of controls as HalfNormal Distribution where as for another set of control variables Normal Distribution.

edavishydro commented 1 month ago

How does this work with the Prior class implementation? Can I do something like this? Prior("TruncatedNormal", mu=0, sigma=2, lower=np.array([*np.repeat(0, 2), *np.repeat(-np.inf, 2)]), dims="channels")