OptimizationVariable#

class pymc_marketing.mmm.optimization_variables.OptimizationVariable[source]#

One named, contiguous segment of the flat decision vector.

A variable describes a single model variable that the optimizer controls: how its slice of the flat vector becomes the model-space tensor substituted into the graph (to_model()), how a solution slice becomes a labelled DataArray (unpack()), and the exact inverse of that labelling (pack()).

Attributes:
namestr

Name of the model variable this variable substitutes.

dimstuple[str, …]

Dimension names of the variable’s labelled representation.

coordsdict[str, list]

Coordinates for dims.

flat_dimstr

Name of the flat decision vector’s dimension. Owned by the containing OptimizationVariables, which assigns it at construction.

Methods

OptimizationVariable.__init__(*args, **kwargs)

OptimizationVariable.budget_contribution(z)

Monetary amount this variable draws from the shared budget.

OptimizationVariable.default_bounds(total_budget)

Default (low, high) bounds per flat entry.

OptimizationVariable.default_x0(total_budget)

Default initial guess for this variable's slice.

OptimizationVariable.pack(da)

Exact inverse of unpack().

OptimizationVariable.to_model(z)

Map this variable's slice of the flat vector to its model-space tensor.

OptimizationVariable.unpack(x)

Map a solution slice to a labelled DataArray.

Attributes

size

Number of entries this variable occupies in the flat vector.

name

dims

coords

flat_dim