rasmusbergpalm / pymc3-quap

Quadratic Approximation for PyMC3
MIT License
4 stars 2 forks source link

Incorrect uncertainties whe used with PyMC4 and PyMC5 #2

Open ivanistheone opened 9 months ago

ivanistheone commented 9 months ago

In case anyone is using this library with PyMC v4 or v5, note the need to "un-transform" the variables before computing the Hessian, otherwise the uncertainty of the estimates will be incorrect.

I read about this problem here: https://github.com/pymc-devs/pymc/issues/5443#issuecomment-1030609090

Applying the fix to the quap function looks like this: https://github.com/ivanistheone/pymc_Rethinking_3/commit/0f498e7abbb43d41999f5e0a1aba416c066d2ce3

Note this is not an issue in PyMC3 since the find_MAP and find_hessian are both base don un-transformed coordinates.

I'd be happy to submit a PR with this fix, though not sure how to make the code compatible with both PyMC3 and PyMC4+.