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
855 stars 176 forks source link

Ambiguitiy in `optimal_allocation_per_time_unit` argument of `plot_response_curve` #135

Open openerror opened 1 year ago

openerror commented 1 year ago

I think I finally figured it out with trial-and-error, but confirmation from people in the know would be great. Then if appropriate/feasible, I can contribute documentation.

The question is: after obtaining an optimized budget, how should I calculate optimal_allocation_per_timeunit for plot_response_curve? It is important to specify this argument, so that we get an intuitive, visual idea of how budgets should be shifted.

Following exactly the example notebook in this repo,

^Is what I did correct? I tried several other things before, such as giving the plotting function optimal_budget_allocation directly, dividing that by 20 etc. It is simply not clear that I am supposed (?) to use media_scaler.

FYI, the documentation currently says the following about optimal_allocation_per_timeunit.

If ‘ optimal_allocation_per_timeunit is given it uses it to add markers based on historic average spend and the given optimal one on each of the individual subplots.

optimal_allocation_per_timeunit – Optimal allocation per time unit per media channel. This can be obtained by running the optimization provided by LightweightMMM.

michevan commented 1 year ago

I think you want optimal_allocation_per_timeunit to be media_scaler.transform(optimal_budget_allocation)/n_time_periods, but I agree this is unclear and we'll try to improve this workflow. Thanks for flagging this!