MMM.allocate_budget_to_maximize_response#
- MMM.allocate_budget_to_maximize_response(budget, time_granularity, num_periods, budget_bounds=None, custom_constraints=None, quantile=0.5, noise_level=0.01)[source]#
Allocate the given budget to maximize the response over a specified time period.
This function optimizes the allocation of a given budget across different channels to maximize the response, considering adstock and saturation effects. It scales the budget and budget bounds, performs the optimization, and generates a synthetic dataset for posterior predictive sampling.
The function first scales the budget and budget bounds using the maximum scale of the channel transformer. It then uses the
BudgetOptimizer
to allocate the budget, and creates a synthetic dataset based on the optimal allocation. Finally, it performs posterior predictive sampling on the synthetic dataset.- Parameters:
- budget
float
orint
The total budget to be allocated.
- time_granularity
str
The granularity of the time units (num_periods) (e.g., ‘daily’, ‘weekly’, ‘monthly’).
- num_periods
float
The number of time units over which the budget is to be allocated.
- budget_bounds
dict
[str
,list
[Any
]], optional A dictionary specifying the lower and upper bounds for the budget allocation for each channel. If None, no bounds are applied.
- custom_constraints
dict
[str
,float
], optional Custom constraints for the optimization. If None, no custom constraints are applied.
- quantile
float
, optional The quantile to use for recovering transformation parameters. Default is 0.5.
- budget
- Returns:
az.InferenceData
The posterior predictive samples generated from the synthetic dataset.
- Raises:
ValueError
If the time granularity is not supported.