Why doesn't this pymc3 model show shrinkage?

Well done on this workflow James :clap:
Regarding target_accept, it does make sampling slower, so if your model was already slow, it could be a problem. Here it doesn’t seem to be the case. But as you said, you have to remain vigilant: if the model seems unstable and regularly shows divergences, then there could be a problem with your model itself. Here, I think you found it: the group sigma was very close to zero, so you needed the non-centered parametrization.

A couple more observations:

  • The priors I used for sigma and, notably, a are not tailored to your model. Doing prior predictive checks could help your model sample better.
  • I’m guessing you’re using toy data, but there are only a few of them, and only two clusters – at the group level, this means you’re trying to estimate a standard deviation (sigma) with only two data points (the clusters). This is of course a problem; you usually need at least 15-20 clusters I’d say.
  • Taking more tuning samples would probably help the sampler. A good default for most simple models is pm.sample(1000, tune=2000). Most people take more tuned samples than tuning samples, but in the Bayesian framework I’d say the latter are more important than the former.

Hope this helps, and congrats again on making your model run :vulcan_salute:

2 Likes