How do I predict on new, unseen real data using pm.sample_posterior_predictive?

You can use set_data() to swap out the data you used for inference for something new (e.g., out-of-sample test data) before running sample_posterior_predictive. That will allow you to use your estimated model parameters to generate predictions about your outcome (i.e., Y in your case) in a new scenario (i.e., for new values of dX1, dX2, etc.).

This notebook may be of additional use to you.

[Edit: documentation links updated]

6 Likes