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
648 stars 175 forks source link

More informative `initial_guess` in `BudgetOptimizer` #876

Open AlfredoJF opened 1 month ago

AlfredoJF commented 1 month ago

Just wondering the reasoning behind initial_guessto be set flat across all channels.

https://github.com/pymc-labs/pymc-marketing/blob/9755d3b16f1389bc695a3dac3495a47e1cce0ee9/pymc_marketing/mmm/budget_optimizer.py#L185

Shouldn't be more helpful and informative to the optimizer to start with a historical share?


initial_guess = (self.X[self.channel_columns].sum() /
                 self.X[self.channel_columns].sum().sum())
                 .values * total_budget
cetagostini commented 1 month ago

Hey @AlfredoJF

This is actually a very good idea, I'll added to the plans. Meantime, I'll be very happy if you can open a PR and move forward this implementation!

Let me know if, you would like to. I can give you a hand 🤚

AlfredoJF commented 1 month ago

Hey @cetagostini

Yeah sounds good, I'll try to get it done this week.

What do you think, should this replace the initial_guess array or have it as an option in allocate_budget similar to custom_constraints logic?

https://github.com/pymc-labs/pymc-marketing/blob/9755d3b16f1389bc695a3dac3495a47e1cce0ee9/pymc_marketing/mmm/budget_optimizer.py#L120