Skip to content

Commit 120fc4e

Browse files
committed
Improve example on expanded sample_posterior_predictive
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
1 parent 81d31c8 commit 120fc4e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pymc/sampling/forward.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -711,9 +711,14 @@ def sample_posterior_predictive(
711711
712712
.. code:: python
713713
714-
expanded_data = idata.posterior.expand_dims(pred_id=5)
714+
expanded_idata = idata.copy()
715+
expanded_idata.posterior = idata.posterior.expand_dims(pred_id=5)
715716
with model:
716-
idata.extend(pm.sample_posterior_predictive(expanded_data))
717+
pm.sample_posterior_predictive(
718+
expanded_idata,
719+
sample_dims=["chain", "draw", "pred_id"],
720+
extend_inferencedata=True,
721+
)
717722
718723
719724
"""

0 commit comments

Comments
 (0)