CounterfactualScenarios#
- class pymc_marketing.mmm.counterfactual.CounterfactualScenarios(spend, period_index, rows)[source]#
Perturbed spend arrays for every scenario that has to be evaluated.
A scenario is a (period, perturbed channel) pair. When no
mu_effectstands between spend and the response, a single all-channels perturbation per period suffices and every channel reads its own column out of it, so all of a period’s keys point at the same row – seeEvaluationWindows.build_scenarios().- Parameters:
- spend
np.ndarray Counterfactual
channel_data, shape(n_scenarios, max_window, *extra_shape).- period_index
np.ndarray Period each scenario belongs to, shape
(n_scenarios,). Indexes any per-period array (a windowed data variable, atime_indexrow) up to the scenario axis.- rows
dict Maps a
_ScenarioKeyto a row ofspend.
- spend
See also
PeriodWindowWhich dates each period is evaluated over, and which are summed.
Methods
CounterfactualScenarios.__init__(spend, ...)Attributes
spendperiod_indexrows