I’m using Google Colab for teaching Bayesian statistics and it is curently on PyMC 4.1.4 and Arviz 12.1. I’m teaching out of Bayesian Analysis with Python by @aloctavodia (as well as other texts).

In Chapter 5 of the text, they use the function sample_posterior_predictive_w. In PyMC 4.1.4 it says that this function is “not yet implemented” in PyMC 4. In the latest version of PyMC, it says that it is deprectated in favor of weights_prediction in Arviz. However, I didn’t find any mention of weights_prediction in the current versoin of Arviz. There is an Arviz issue which I guess means it is merged into an upcoming release?

In any case, I’d like to be able to show this functionality in the Colab-current versions of Arviz and PyMC. Is there a simple way to do this?

So, colab is still on 12.1. I could probably install 14, but now I’m curious: is there an easy way to replicate the functionality without calling the function?

Also the fuction is relatively simple, given a list of idatas with posterior predictive samples it takes a new set of samples from each idata, proportional to the weights. So if you have two models/idatas one with weight 0.6 and the other 0.4 and you ask for 1000 weighted samples, the function will return 600 samples from one model/idata and 400 from the other. You can check the code here