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
896 stars 192 forks source link

Same pre-optimization and post-optimization channel budget allocation ratios , but suggesting much higher budget instead of aligning the budget to the one i requested. #297

Open entzyeung opened 10 months ago

entzyeung commented 10 months ago

Dear LMMM Team,

I want to express my sincere appreciation for the hard work you've dedicated to creating this remarkable model. It's truly impressive and has proven to be user-friendly and easy to install, unlike my previous attempt with the FB Robyn model, which I eventually abandoned due to its complexity. Discovering your model felt like a ray of sunshine after a cloudy day.

To cut to the chase, I've encountered a similar issue to that of @DongHarry-Kang. I've spent considerable time experimenting with various datasets and fine-tuning for two weeks. However, I consistently obtain similar results when calling the plot_pre_post_budget_allocation_comparison function.

I've included some sample outputs below:

Output 1

Output 2

I've thoroughly examined data quality using check_data_quality(), assessed variances with highlight_variances(), reviewed spend fractions with highlight_low_spend_fractions(), and analyzed variance inflation factors with highlight_high_vif_values(). The datasets appear to be in good shape and suitable for analysis. I even trained the best model with parameters obtained from Gridsearches. However, when it comes to the critical aspect of budget allocation, it seems there may be an issue.

Regardless of how I adjust the budget and cost parameters, the model consistently produces the same outcome: maintaining the same channel ratios while suggesting a higher budget allocation.

Allow me to illustrate this with an example.

Screenshot 2024-01-07 at 22 55 23

As you can see from the investigation, the model did suggest me different and higher budget while maintaining the same channel ratios. I am so confused that why the model not reallocating the budgets as the documentation said? and keep increasing our budget instead? is there any params I missed? if not, is there any way to fix it?

Here is my syntax when calling the optimizatin function:

Run optimization with the parameters of choice.

solution, kpi_without_optim, previous_media_allocation = optimize_media.find_optimal_budgets(
            n_time_periods= n_time_periods,
            media_mix_model= mmm,
            extra_features= extra_features_test[:n_time_periods],# it has been scaled.
            budget= budget,
            prices= prices,
            media_scaler = media_scaler,
            target_scaler = target_scaler,
            )

Plot out pre post optimization budget allocation and predicted target variable comparison.

plot.plot_pre_post_budget_allocation_comparison(media_mix_model=mmm, 
                                                kpi_with_optim=solution['fun'], 
                                                kpi_without_optim=kpi_without_optim,
                                                optimal_buget_allocation=optimal_buget_allocation, 
                                                previous_budget_allocation=previous_budget_allocation, 
                                                figure_size=(10,10))

Thank you in advance.

santiarias commented 10 months ago

@entzyeung could you post your baseline_contribution_area plot?

entzyeung commented 10 months ago

Thank you @santiarias, here you go.

Screenshot 2024-01-12 at 15 25 48

and i have another discussion going on: here

santiarias commented 10 months ago

@entzyeung thanks, could you also do a mmm.print_summary() and plot_model_fit and post them here? And some very small sample of your data? sorry for asking this in 2 different messages

entzyeung commented 10 months ago

No problem at all, but I m outside right now, I will send once I go back home. Thank you @santiarias

entzyeung commented 10 months ago

@santiarias here you go! It's looks like a workable model to my eyes, maybe i am wrong.

Screenshot 2024-01-12 at 21 09 59 Screenshot 2024-01-12 at 21 10 22
entzyeung commented 10 months ago

@santiarias please feel free to let me know if you want some extra info about my model anytime.

santiarias commented 10 months ago

@entzyeung yeah if you could just show a very small sample of your training data (just a few rows is enough)

entzyeung commented 10 months ago

@santiarias sure thing, here you go. Data I extracted the first 10 rows of each dataset just before applying jnp.array to them.

Screenshot 2024-01-16 at 18 20 02
entzyeung commented 10 months ago

@santiarias does the link work? please feel free to let me know if it is not working.

entzyeung commented 9 months ago

Would the development team please help?