BudgetOptimizerWrapper.sample_response_distribution#

BudgetOptimizerWrapper.sample_response_distribution(allocation_strategy, noise_level=0.001, additional_var_names=None, include_last_observations=False, include_carryover=True, budget_distribution_over_period=None)[source]#

Generate synthetic dataset and sample posterior predictive based on allocation.

Parameters:
allocation_strategyxr.DataArray

The allocation strategy for the channels.

noise_levelfloat

The relative level of noise to add to the data allocation.

additional_var_nameslist[str] | None

Additional variable names to include in the posterior predictive sampling.

include_last_observationsbool

Whether to include the last observations for continuity.

include_carryoverbool

Whether to include carryover effects.

budget_distribution_over_periodxr.DataArray | None

Fixed temporal distribution of each budget cell across periods. Must have dims ("date", *budget_dims) where "date" has length num_periods. Values must sum to 1 along "date" for every combination of the remaining dims (i.e., budget_distribution_over_period.sum(dim="date") must be all ones). If provided, multiplies the allocation by this distribution to create the per-period spending pattern.

Returns:
xr.Dataset

The posterior predictive samples based on the synthetic dataset.