Manuscript Error: Code 1.7 doesn't work in PyMC version 5 · Issue #204 · BayesianModelingandComputationInPython/BookCode_Edition1 · GitHub
Skip to content

Manuscript Error: Code 1.7 doesn't work in PyMC version 5 #204

Open

Description

@bskrainka

Description

The code block Code 1.7 doesn't work in PyMC version 5. The interface is now substantially different.

pred_dists = (pm.sample_prior_predictive(1000, model)["y_obs"],
              pm.sample_posterior_predictive(idata, 1000, model)["y_obs"])

Reference

p. 12, Code 1.7

Author Section

Do not close until

  • Added to Errata
  • Fixed in Open Access
  • Fixed in latex source

Activity

  1. BochkarevV commented on Jun 12, 2023

    @BochkarevV

    Hi @bskrainka. To the best of my understanding, the book is using PyMC version 3.11.4 (https://github.com/BayesianModelingandComputationInPython/BookCode_Edition1/blob/main/environment.yml), so it should be possible to execute the code with this version.

    However, I also went for the most recent PyMC version which was 5.0.2 when I started reading the book and experienced similar issues as you did. I found some workarounds how to execute the code with minimal changes. In particular, the code snippet you refer to should be updated to this:

    pred_dists = (pm.sample_prior_predictive(1000, model, var_names=["y_obs"]),
                  pm.sample_posterior_predictive(idata, model, var_names=["y_obs"]))
    

    Nonetheless, I hope the authors will update the book to make it usable with newer PyMC versions. Found it to be a great source with clear explanations and practical examples.

  2. canyon289 commented on Jun 12, 2023

    @canyon289
    Contributor

    Hey folks, both thank you for the kind words and apologies for the trouble. The book is written in PyMC3, the concepts will be the same for PyMC v5, or any ppl, but the code will not, hence why PyMC is at v5.

    We wont be updating the code anytime this year to be frank, but we do expect to write a second edition of this book which will update the code and add additional topics.

    You can get hepl from the pymc discourse for api help. Ourselves and a number of the core contributors are active there.
    https://discourse.pymc.io/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions