Skip to content

Conversation

@fonnesbeck
Copy link
Member

@fonnesbeck fonnesbeck commented Jun 19, 2025

A notebook adapted from course material on how to implement Gelman et al.'s Bayesian workflow, using a COVID-19 dataset.

Helpful links


📚 Documentation preview 📚: https://pymc-examples--797.org.readthedocs.build/en/797/

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@fonnesbeck
Copy link
Member Author

Not sure if this belongs in case studies or elsewhere ...

@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

twiecki commented on 2025-06-19T14:52:53Z
----------------------------------------------------------------

A lot of these have not plot?


fonnesbeck commented on 2025-06-19T19:58:54Z
----------------------------------------------------------------

I don't understand the question.

aloctavodia commented on 2025-06-19T20:06:11Z
----------------------------------------------------------------

I think he means that a lot of the plots are not visible...

fonnesbeck commented on 2025-06-19T20:11:30Z
----------------------------------------------------------------

That's odd. Will ask Oriol about this. Would be a shame if we can't use plotly in the docs.

fonnesbeck commented on 2025-06-19T20:48:38Z
----------------------------------------------------------------

OK, I've fixed this. Thanks.

@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

twiecki commented on 2025-06-19T14:55:49Z
----------------------------------------------------------------

Maybe add COVID-19 or infection modeling to the title.


@twiecki
Copy link
Member

twiecki commented Jun 19, 2025

Not sure if this belongs in case studies or elsewhere ...

Either case-study or howto, leaning towards the latter.

@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T18:40:00Z
----------------------------------------------------------------

The first two sentences could be "Bayesian modeling is a robust approach to draw conclusions from data. Successful modeling involves an interplay..."


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T18:40:01Z
----------------------------------------------------------------

A slightly different way to write this would be

dist = pz.Gamma()

pz.maxent(dist, lower=0.1, upper=20, mass=0.95);

Then, in the next cell

fig = px.histogram(x=dist.rvs(1000), nbins=20, title="Gamma Distribution Samples")

fig.show()

and in the model

alpha = dist.to_pymc("alpha")


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T18:40:01Z
----------------------------------------------------------------

we can use

alpha = pz.maxent(pz.Gamma(), lower=0.1, upper=20, mass=0.95, plot=False).to_pymc("alpha")

instead of

  gamma_params = pm.find_constrained_prior(

    pm.Gamma, lower=0.1, upper=20, init_guess={"alpha": 6, "beta": 1}, mass=0.95

  )

  alpha = pm.Gamma("alpha", **gamma_params)


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T18:40:02Z
----------------------------------------------------------------

plt.tight_layout() not neccesary given that we are using "arviz-doc" style


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T18:40:03Z
----------------------------------------------------------------

plt.show() not neccesary?


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T18:40:03Z
----------------------------------------------------------------

Just for your information "New ArviZ", has functionality for prior/likelihood sensitivity checks, see https://arviz-devs.github.io/EABM/Chapters/Sensitivity_checks.html

No needed to be done now, but maybe in a next round of revision we could use "new arviz" its new prior checks, or new plot like rank plots...


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T18:40:04Z
----------------------------------------------------------------

"sampels"


Copy link
Member Author

I don't understand the question.


View entire conversation on ReviewNB

Copy link
Member

I think he means that a lot of the plots are not visible...


View entire conversation on ReviewNB

Copy link
Member Author

That's odd. Will ask Oriol about this. Would be a shame if we can't use plotly in the docs.


View entire conversation on ReviewNB

Copy link
Member Author

OK, I've fixed this. Thanks.


View entire conversation on ReviewNB

@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T21:03:15Z
----------------------------------------------------------------

This can be removed


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T21:03:16Z
----------------------------------------------------------------

Add ;


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T21:03:16Z
----------------------------------------------------------------

Also add ;


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T21:03:17Z
----------------------------------------------------------------

Add ;


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T21:03:18Z
----------------------------------------------------------------

Add ;


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 19, 2025

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2025-06-19T21:03:18Z
----------------------------------------------------------------

Add ;


@fonnesbeck
Copy link
Member Author

Everyone cool with these changes?

@fonnesbeck fonnesbeck merged commit 57a24c0 into pymc-devs:main Jun 20, 2025
2 checks passed
@fonnesbeck fonnesbeck deleted the bayes_workflow2 branch June 20, 2025 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants