OptimizationVariables#

class pymc_marketing.mmm.optimization_variables.OptimizationVariables(variables, flat_name='budgets_flat', flat_dim='budgets_flat')[source]#

The complete decision vector: an ordered list of variables.

Owns the single flat symbolic input, the contiguous slice layout, and the forward/inverse maps between the flat vector and per-variable labelled DataArray objects. The slice layout tiles [0, size) exactly: variables are laid out in order with no gaps or overlaps.

Parameters:
variableslist[OptimizationVariable]

Variables in flat-vector order.

flat_namestr

Name of the flat symbolic variable.

flat_dimstr

Dimension name of the flat symbolic variable.

Methods

OptimizationVariables.__init__(variables[, ...])

OptimizationVariables.bounds(total_budget[, ...])

Assemble per-entry bounds, variable by variable.

OptimizationVariables.budget_contributions()

Monetary contributions of every variable that spends from the pot.

OptimizationVariables.pack(values)

Assemble a flat vector from labelled per-variable values.

OptimizationVariables.spending_variables()

Return the variables that draw from the shared budget.

OptimizationVariables.substitutions()

Model substitution dict: one entry per variable, one joint graph.

OptimizationVariables.unpack(x)

Split a flat solution into labelled per-variable DataArray objects.

OptimizationVariables.variable_slice(name)

Return the symbolic slice of the flat vector for variable name.

OptimizationVariables.x0(total_budget)

Default initial guess: each variable's default_x0 concatenated.