Skip to content

Commit

Permalink
Adding docstring on the function
Browse files Browse the repository at this point in the history
  • Loading branch information
cetagostini committed Jul 25, 2023
1 parent 8cd82ce commit 2bbd10f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pymc_marketing/mmm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,35 @@ def budget_allocation(
parameters: Optional[Dict[str, Tuple[float, float]]],
budget_bounds: Optional[Dict[str, Tuple[float, float]]],
) -> pd.DataFrame:
"""
Allocate the budget optimally among different channels based on estimations and budget constraints.
Parameters
----------
total_budget : int, requiere
The total budget available for allocation.
parameters : dict, requiere
A DataFrame containing estimations and information about different channels.
budget_bounds : dict, optional
A dictionary specifying the budget bounds for each channel.
Returns
-------
Dict
A dictionary containing the allocated budget and contribution information.
Raises
------
ValueError
If any of the required parameters are not provided or have an incorrect type.
"""
if not isinstance(budget_bounds, dict):
raise ValueError("The 'budget_bounds' parameter must be a dictionary.")

if not isinstance(total_budget, (int, float)):
raise ValueError(
"The 'total_budget' parameter must be an integer or float."
)

return budget_allocator(
total_budget=total_budget,
Expand Down

0 comments on commit 2bbd10f

Please sign in to comment.