calculate_expected_contribution#

pymc_marketing.mmm.budget_optimizer.calculate_expected_contribution(method, parameters, budget)[source]#

Calculate expected contributions using the specified model.

This function calculates the expected contributions for each channel based on the chosen model. The selected model can be either the Michaelis-Menten model or the sigmoid model, each described by specific parameters. As the allocated budget varies, the expected contribution is computed according to the chosen model.

Parameters:
  • method (str) – The model to use for contribution estimation. Choose from ‘michaelis-menten’ or ‘sigmoid’.

  • parameters (Dict) –

    Model-specific parameters for each channel. For ‘michaelis-menten’, each entry is a tuple (L, k) where: - L is the maximum potential contribution. - k is the budget at which the contribution is half of its maximum.

    For ‘sigmoid’, each entry is a tuple (alpha, lam) where: - alpha controls the slope of the curve. - lam is the budget at which the curve transitions.

  • budget (Dict) – The total budget.

Returns:

A dictionary with channels as keys and their respective contributions as values. The key ‘total’ contains the total expected contribution across all channels.

Return type:

Dict

Raises:

ValueError – If the specified method is not recognized.