BudgetOptimizationResult#
- class pymc_marketing.mmm.budget_optimizer.BudgetOptimizationResult(budgets, scipy_result, optimized_vars=<factory>, spend_var_names=<factory>, callback_info=None)[source]#
Result of
BudgetOptimizer.allocate_budget().Iterating the result yields
(budgets, scipy_result), so the long-standing two-element unpacking keeps working unchanged:optimal_budgets, scipy_result = optimizer.allocate_budget(...)
Attribute access is the recommended interface going forward.
- Attributes:
- budgets
xarray.DataArray The optimized budget allocation in monetary units, labelled with the model’s budget dims and coords.
- scipy_result
scipy.optimize.OptimizeResult The raw scipy optimization result (solver diagnostics,
x,fun, convergence status).- optimized_vars
dict[str,xarray.DataArray] Optimal values of every decision variable other than the media budgets, by name:
optimizable_varslevers in their own units, andspend_varsmonetary variables in money. Empty when neither is declared. Note that a monetary entry here andbudgetsare the same kind of quantity, drawn from the same total –budgetsis singled out because it is the allocation most callers want, not because it is the only spend.- spend_var_names
list[str] Which
optimized_varsentries are monetary, i.e. the declaredspend_vars. Recorded so the result can say on its own which of its allocations draw from the budget; seespend_var_allocations.- callback_info
list[OptimizationIterationInfo] orNone Per-iteration diagnostics (
x,fun,jac, constraint values) whenallocate_budget(callback=True);Noneotherwise.
- budgets
Methods
BudgetOptimizationResult.__init__(budgets, ...)Attributes
callback_infospend_var_allocationsThe
optimized_varsentries that are money rather than levers.budgetsscipy_resultoptimized_varsspend_var_names