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
710 stars 199 forks source link

Scipy minimize using analytical gradients #780

Open ProxyCausal opened 5 months ago

ProxyCausal commented 5 months ago

I'm wondering why in the budget optimizer analytical gradients are not used instead of finite difference since they are faster and more accurate. With large dataset finite difference doesn't seem feasible. It seems gradients for adstock and hill isn't hard to calculate in analytical form.

juanitorduz commented 4 months ago

@ProxyCausal would you like to try opening a PR? :)

wd60622 commented 4 months ago

Should be able to make use of pytensor for the derivatives. pt.grad is the function?

wd60622 commented 2 weeks ago

@cetagostini Is this something we can use in latest PR?

cetagostini commented 2 weeks ago

Yes, we have a discussion about it on retreat. Let's bring that back, if we have a way to be able to estimate derivatives for all current saturations and adstock, then it would be a nice switch from symbolic to analytical.