optimize_budget_distribution#

pymc_marketing.mmm.budget_optimizer.optimize_budget_distribution(method, total_budget, budget_ranges, parameters, channels)[source]#

Optimize the budget allocation across channels to maximize total contribution.

Using the Michaelis-Menten or Sigmoid function, this function seeks the best budget distribution across channels that maximizes the total expected contribution.

This function leverages the Sequential Least Squares Quadratic Programming (SLSQP) optimization algorithm to find the best budget distribution across channels that maximizes the total expected contribution based on the Michaelis-Menten or Sigmoid functions.

The optimization is constrained such that: 1. The sum of budgets across all channels equals the total available budget. 2. The budget allocated to each individual channel lies within its specified range.

The SLSQP method is particularly suited for this kind of problem as it can handle both equality and inequality constraints.

Parameters:
  • total_budget (int) – The total budget to be distributed across channels.

  • budget_ranges (Dict or None) – An optional dictionary defining the minimum and maximum budget for each channel. If not provided, the budget for each channel is constrained between 0 and its L value.

  • parameters (Dict) – Michaelis-Menten parameters for each channel as described in calculate_expected_contribution.

  • channels (list of str) – The list of channels for which the budget is being optimized.

Returns:

A dictionary with channels as keys and the optimal budget for each channel as values.

Return type:

Dict