In the Conjugate Models Lesson (in the video and the notebook) we’re shown a PyMC model and then a single line Preliz statement:

Why are we shown both and not just the `pz.Beta(2+8,10+92).plot_pdf()`

?

Is pz.Beta() somehow grabbing the results of the pm.Model from memory? Or are they just both being shown so that we see how we’d model it both ways?

I’m doing the exercise where we’re asked to “Use the prior you found in `2b`

to compute the posterior using conjugancy” [*sic*] and wondering if I need to run both or just one to get the posterior.

The solution to the exercise is

`pz.Beta(3 + 8, 5.5 + 92).plot_pdf();`

But isn’t that just plotting a beta distribution with new parameters? How does that have any relationship with a prior?

We’re showing both just for comparison. There is nothing shared between preliz and pymc in this code.

With conjugate models is just plotting the new beta distribution with new parameters. The priors are just the numbers that “get added to”. Conjugate models are quite great in this regard because when the math works out it feels *too easy*

One a related note, the hidden cells in the notebook (along with the typos) will be fixed soon with more clear explanations, as will the dark mode plots.

1 Like

Thank you!

Do people ever just “snap” whatever they’re modeling to the nearest conjugate for simplicity because they’re only looking for approximation? e.g.

- the data looks uniform so you go with to beta(0,0)
- the data looks normal so you go with beta(20,20)
- the data looks power law/exponential so you go with beta(5,.5) or beta(1,.5)
- and so on

If you do that, can you still calculate your posterior using conjugacy or are there limits like beta values greater than X can no longer be used?

If you stick with the conjugate distributions there are no limits on the parameters. The limitation in conjugate distributions comes from having to stick with those distributions.

As for do people “snap” the short answer is yes. If you know you can get precise or even “close enough” results with conjugate distributions then by all means use them. We wrote about one example in our book, where if you need reealllyyy fast inference using conjugate models is the way to go.

https://bayesiancomputationbook.com/markdown/chp_10.html#example-near-real-time-inference

1 Like