-
-
Notifications
You must be signed in to change notification settings - Fork 144
Description
Code is broken for listing 1.6: predictive_distributions
`pred_dists = (pm.sample_prior_predictive(1000, model)["y_obs"],
pm.sample_posterior_predictive(idata, 1000, model)["y_obs"])`
Neither the first or second part of the tuple function properly.
for the first part of the tuple the error I received was
"'AttributeError: 'InferenceData' object has no attribute 'y_obs' ".
This was simple enough to correct and it worked after I changed the line to
pm.sample_prior_predictive(1000, model).prior_predictive["y_obs"]
For the second part of the tuple there were several errors:
The initial error I received was:
"IncorrectArgumentsError: Should not specify both keep_size and samples arguments. See the docstring of the samples argument for more details. "
I looked online and then added the argument keep_size = False to my code:
pm.sample_posterior_predictive(idata, 1000, model, keep_size=False)["y_obs"]
However this now generates the following error:
"ValueError: conflicting sizes for dimension 'chain': length 1 on the data but length 2 on coordinate 'chain' "
I'm sure there is a simple fix and don't think it will stop me continuing to use this book, but these errors definitely break the immersion with the learning process. Hopefully this can be resolved quickly.