Could somebody provide a minimal example for sample_posterior_predictive()

Can somebody please provide me with a minimal working example of sample_posterior_predictive() in the context of Bayesian Linear Regression? I have tried working with the example notebook, but attempting to use pm.set_data() on my data causes key errors. The procedure I am trying to build is as follows:

  1. Get some random dataset (e.g. Iris)
  2. Split data into training and test set
  3. Construct a linear model to predict one column as function of the other columns, choose some priors, fit using training data
  4. Sample the posterior distribution
  5. Sample the predictive posterior distribution using the test set

I’m struggling with point 5). I can send my notebook if you wish

1 Like

At the very end of this notebook there is an example that I think sounds like what you’re wanting to do. Does it help?

Can you share a minimal example? I’m not sure what to make of key errors

We are planning to divide the example you cite in two, one for posterior predictive sampling, the other for predictive checks (prior or posterior), see prior and posterior predictive checks · Issue #69 · pymc-devs/pymc-examples · GitHub