Skip to content

Commit

Permalink
Improve example on expanded sample_posterior_predictive
Browse files Browse the repository at this point in the history
Sample posterior_predictive relies on other groups to infer volatility, so it's important to keep the whole InferenceData.

Also there's a shape error if `sample_dims` is not specified
  • Loading branch information
ricardoV94 committed Mar 27, 2024
1 parent 81d31c8 commit 120fc4e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pymc/sampling/forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,14 @@ def sample_posterior_predictive(
.. code:: python
expanded_data = idata.posterior.expand_dims(pred_id=5)
expanded_idata = idata.copy()
expanded_idata.posterior = idata.posterior.expand_dims(pred_id=5)
with model:
idata.extend(pm.sample_posterior_predictive(expanded_data))
pm.sample_posterior_predictive(
expanded_idata,
sample_dims=["chain", "draw", "pred_id"],
extend_inferencedata=True,
)
"""
Expand Down

0 comments on commit 120fc4e

Please sign in to comment.