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:
budgetsxarray.DataArray

The optimized budget allocation in monetary units, labelled with the model’s budget dims and coords.

scipy_resultscipy.optimize.OptimizeResult

The raw scipy optimization result (solver diagnostics, x, fun, convergence status).

optimized_varsdict[str, xarray.DataArray]

Optimal values of every decision variable other than the media budgets, by name: optimizable_vars levers in their own units, and spend_vars monetary variables in money. Empty when neither is declared. Note that a monetary entry here and budgets are the same kind of quantity, drawn from the same total – budgets is singled out because it is the allocation most callers want, not because it is the only spend.

spend_var_nameslist[str]

Which optimized_vars entries are monetary, i.e. the declared spend_vars. Recorded so the result can say on its own which of its allocations draw from the budget; see spend_var_allocations.

callback_infolist[OptimizationIterationInfo] or None

Per-iteration diagnostics (x, fun, jac, constraint values) when allocate_budget(callback=True); None otherwise.

Methods

Attributes

callback_info

spend_var_allocations

The optimized_vars entries that are money rather than levers.

budgets

scipy_result

optimized_vars

spend_var_names