The mmm example case study here MMM End-to-End Case Study — Open Source Marketing Analytics Solution
passes weekly budget divided by the number of channels to mmm.optimize_budget. Why? The documentation for that function states that budget = The total budget to be allocated. Wouldn’t dividing by the number channels misrepresent the total budget? What does “The total budget to be allocated” actually mean? Total across all channels? Across a single channel?
# Weekly budget for each channel
# We are assuming we do not know the total budget allocation in advance
# so this would be the naive "uniform" allocation.
per_channel_weekly_budget = all_budget / (num_periods * len(channel_columns))
model_granularity = "weekly"
allocation_strategy, optimization_result = mmm.optimize_budget(
budget=per_channel_weekly_budget,
num_periods=num_periods,
budget_bounds=budget_bounds,
minimize_kwargs={
"method": "SLSQP",
"options": {"ftol": 1e-9, "maxiter": 5_000},
},
)