google / lightweight_mmm

LightweightMMM 🦇 is a lightweight Bayesian Marketing Mix Modeling (MMM) library that allows users to easily train MMMs and obtain channel attribution information.
https://lightweight-mmm.readthedocs.io/en/latest/index.html
Apache License 2.0
888 stars 190 forks source link

optimize spend lower/upper bounds held constant don't work when spend is not linear to avg media spend * n_time_periods #161

Open ohad-monday opened 1 year ago

ohad-monday commented 1 year ago

Im running the demo, and trying to keep one of the channels constant (with lower/upper bounds = 0). It works fine when im using (btw i removed the extra features in the demo): setting lower/upper bounds with 1st channel constant: lower = jnp.repeat(0.2, mmm.n_media_channels) upper = jnp.repeat(0.2, mmm.n_media_channels) lower = lower.at[0].set(0) upper = upper.at[0].set(0) and (same as in the demo): n_time_periods = 10 budget = jnp.sum(jnp.dot(prices, media_data.mean(axis=0)))* n_time_periods

works fine, channel 1 is same (previous=optimal)

image

BUT, when im using another budget (for example: budget = jnp.sum(jnp.dot(prices, media_data.mean(axis=0)))* 9) channel_1 is not constant (previous!=optimal)

image

How can i keep channels constraints when the spend is not avg media spend * n_time_periods?

thanks!!

michevan commented 1 year ago

Thanks a lot for flagging this! I just wanted to share a link to our new "support" section in the readme to give you some more information on how we can and cannot support such issues at the moment.

ohad-monday commented 1 year ago

@michevan any idea how to approach this? the readme doesn't help here

ar-asur commented 1 year ago

Hi @ohad-monday - Were you able to fix this? I am also facing similar issue where lower bound/upper bound per channel is not met in the optimization.