Skip to content

Commit e39d5d1

Browse files
committed
refactor(mmm): rename optimize_budget **minimize_kwargs to **allocate_budget_kwargs
The variadic on BudgetOptimizerWrapper.optimize_budget relays every keyword to BudgetOptimizer.allocate_budget, not only the scipy minimize options, so the previous name was misleading (callers could end up passing minimize_kwargs={...} inside **minimize_kwargs). Closes #1660
1 parent 1a1d062 commit e39d5d1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

pymc_marketing/mmm/mmm.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3681,7 +3681,7 @@ def optimize_budget(
36813681
budget_distribution_over_period: xr.DataArray | None = None,
36823682
cost_per_unit: pd.DataFrame | xr.DataArray | None = None,
36833683
callback: bool = False,
3684-
**minimize_kwargs,
3684+
**allocate_budget_kwargs,
36853685
) -> (
36863686
tuple[xr.DataArray, OptimizeResult]
36873687
| tuple[xr.DataArray, OptimizeResult, list[dict[str, Any]]]
@@ -3732,8 +3732,10 @@ def optimize_budget(
37323732
**This is independent of the historical cost_per_unit.**
37333733
callback : bool
37343734
Whether to return callback information tracking optimization progress.
3735-
**minimize_kwargs
3736-
Additional arguments for the optimizer.
3735+
**allocate_budget_kwargs
3736+
Extra keyword arguments forwarded to
3737+
:meth:`~pymc_marketing.mmm.budget_optimizer.BudgetOptimizer.allocate_budget`,
3738+
such as ``x0``, ``minimize_kwargs``, and ``return_if_fail``.
37373739
37383740
Returns
37393741
-------
@@ -3782,7 +3784,7 @@ def optimize_budget(
37823784
total_budget=budget,
37833785
budget_bounds=budget_bounds,
37843786
callback=callback,
3785-
**minimize_kwargs,
3787+
**allocate_budget_kwargs,
37863788
)
37873789

37883790
def _apply_budget_distribution_pattern(

0 commit comments

Comments
 (0)