11.16 Rethinking Code

Actually, talking with @OriolAbril made me realize I mixed things up a little in my last explanation, since here we use pm.sample_posterior_predictive to sample a latent variable (p), not an observed variable (pulled_left).

So there is no random sampling involved and I think you’re right when saying that there is "a value of p in trace_11_4 for every value returned by sample_posterior_predictive".

Oriol is preparing a NB about that which will clear that up for you and demonstrate the manual computation I was talking about above – with some sweet xarray magic :wink: Also, chapter 13 will show you the different kinds of possible posterior predictive sampling (which is not possible with chapter 11’s model for various reasons).

1 Like