pymc-devs / pymc-examples

Examples of PyMC models, including a library of Jupyter notebooks.
https://www.pymc.io/projects/examples/en/latest/
MIT License
261 stars 215 forks source link

Add an example of predicting on a new, unseen group in the existing notebook about hierarchical models #418

Open cbrummitt opened 1 year ago

cbrummitt commented 1 year ago

Proposal

In the existing notebook A Primer on Bayesian Methods for Multilevel Modeling, add an example at the bottom, in the section about prediction, about making predictions on a new, unseen group.

Why should this notebook be added to pymc-examples?

The prediction section of the tutorial on multilevel models says that one can make predictions on existing and new groups. But it only gives an example of predicting on an existing group. This addition would fill a gap noted in this Discourse thread.

References

Luciano's reply in the aforementioned Discourse thread has some clues for what the example might look like, though it needs to be updated from pymc3 to pymc.

lucianopaz commented 1 year ago

Thanks for opening the issue @cbrummitt. I had completely lost your question over on discourse. In v4 we wrote a new way to do posterior predictive sampling that is flexible and doesn’t require the use of model factory functions to do out of sample predictions. You’re totally right that this functionality has not been properly showcased and isn’t visible in any of our pymc-examples. When I finish some project related work, I’ll focus on this.