Open fonnesbeck opened 6 months ago
Not sure, the pathfinder return result that underestimated kappa
and theta
:
But probably this is the property of pathfinder, I dont work with it enough to provide good perspective. @ColCarroll has a bit more experience, maybe he has some idea?
See also the issues I found before with the 8 school example, where it would basically return the initval for whatever mu was: https://gist.github.com/ricardoV94/eafd20ac47d63525253b0a8adf5e5d76
yeah the pathfinder have a jaxopt dependency that have some convergent gap (compare to scipy.optimize.minimize). I think on the blackjax side we can be more explicit on detecting none convergence.
For the intermediate, I suggest adding some noise to the initial position: https://github.com/pymc-devs/pymc-experimental/blob/00d7a2b3cf3379e0a9420fb436667ab781e5a5e7/pymc_experimental/inference/pathfinder.py#L104, so at the very least we can run the pathfinder a couple of times.
You can use this to add jitter to RVs: https://github.com/pymc-devs/pymc/blob/0fd7b9e1d2208f1250b1c804bf5421013dba9023/pymc/initial_point.py#L111
This example is taken from the baseball case study in
pymc-examples
. We fit a beta-binomial model to some baseball batting data:and then add a prediction for a fictional player that has zero hits in 4 appearances:
What should occur (and does with either
pymc.sample
orpymc.fit
) is that since the sample size ofy_new
is so small, it should be shrunk towards the population mean. Here is the population of players:and the population mean is given by
phi
:however, the estimate for
theta_new
is way too large (larger than the most extreme player in the fitting dataset) with a high degree of posterior confidence:Running the same model with
pm.fit
orpm.sample
returns more reasonable estimates just under the population mean.Using PyMC 3.10.1 and pymc-experimental from the main repo.