pymc-labs / pymc-marketing

Bayesian marketing toolbox in PyMC. Media Mix (MMM), customer lifetime value (CLV), buy-till-you-die (BTYD) models and more.
https://www.pymc-marketing.io/
Apache License 2.0
715 stars 201 forks source link

Update the `minimize_kwargs` instead of replace #1193

Open wd60622 opened 2 weeks ago

wd60622 commented 2 weeks ago

In the minimize_kwargs exposed to the optimizer, I believe that these should be updated instead of replaced.

That happens here:

https://github.com/pymc-labs/pymc-marketing/blob/fa44cc7fbd134c8a3aa302d0bf2687383f706bff/pymc_marketing/mmm/budget_optimizer.py#L203-L207

The alternative would look like:

minimize_kwargs = {**{
    "method": "SLSQP",
    "options": {"ftol": 1e-9, "maxiter": 1_000},
}, **(minimize_kwargs or {})}

Or something similar.