BudgetOptimizer#

class pymc_marketing.mmm.budget_optimizer.BudgetOptimizer(adstock, saturation, num_days, parameters, adstock_first=True)[source]#

A class for optimizing budget allocation in a marketing mix model.

The goal of this optimization is to maximize the total expected response by allocating the given budget across different marketing channels. The optimization is performed using the Sequential Least Squares Quadratic Programming (SLSQP) method, which is a gradient-based optimization algorithm suitable for solving constrained optimization problems.

For more information on the SLSQP algorithm, refer to the documentation: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html

Parameters:
adstockAdstockTransformation

The adstock class.

saturationSaturationTransformation

The saturation class.

num_daysint

The number of days.

parametersdict

A dictionary of parameters for each channel.

adstock_firstbool, optional

Whether to apply adstock transformation first or saturation transformation first. Default is True.

Methods

BudgetOptimizer.__init__(adstock, ...[, ...])

BudgetOptimizer.allocate_budget(total_budget)

Allocate the budget based on the total budget, budget bounds, and custom constraints.

BudgetOptimizer.objective(budgets)

Calculate the total response during a period of time given the budgets, considering the saturation and adstock transformations.