MMM.budget_optimizer#
- MMM.budget_optimizer(start_date, end_date, *, budgets_to_optimize=None, cost_per_unit=None, compile_kwargs=None, **kwargs)[source]#
Create a
BudgetOptimizerfor a future window.This is the recommended entry point for budget optimization with the multidimensional MMM. It handles building the optimization model, computing
num_periodsand pullingadstock_periodsfrom the fitted adstock. Whenbudgets_to_optimizeis not supplied,BudgetOptimizerauto-detects the optimizable cells from the posterior.- Parameters:
- start_date
strorpd.Timestamp First date of the optimization window (inclusive).
- end_date
strorpd.Timestamp Last date of the optimization window (inclusive).
- budgets_to_optimize
xr.DataArrayorNone, optional Boolean mask defining which budget cells to optimize. Passed straight through to
BudgetOptimizer; whenNonethe optimizer optimizes every cell with a non-zero meanchannel_contributionin the posterior.- cost_per_unit
pd.DataFrameorxr.DataArrayorNone, optional Cost-per-unit conversion factors for non-monetary channels.
- compile_kwargs
dictorNone, optional Extra keyword arguments for PyTensor’s
function().- **kwargs
Additional arguments forwarded to
BudgetOptimizer.
- start_date
- Returns:
BudgetOptimizerA configured optimizer ready for
BudgetOptimizer.allocate_budget().