CamDavidsonPilon / Probabilistic-Programming-and-Bayesian-Methods-for-Hackers

aka "Bayesian Methods for Hackers": An introduction to Bayesian methods + probabilistic programming with a computation/understanding-first, mathematics-second point of view. All in pure Python ;)
http://camdavidsonpilon.github.io/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers/
MIT License
26.51k stars 7.84k forks source link

Shift to the pymc current version #548

Closed miemiekurisu closed 1 year ago

miemiekurisu commented 1 year ago

Update to pymc current version and add some Arviz content

miemiekurisu commented 1 year ago

I'm reading this book again these days and find some of the contents a bit outdated even in pymc3 version. So I plan to update it to pymc current version. I believe that I've tested these new codes in the file well, and it works well under the pymc current version.

CamDavidsonPilon commented 1 year ago

Great, thanks @miemiekurisu. This is pymc4, correct?

miemiekurisu commented 1 year ago

Great, thanks @miemiekurisu. This is pymc4, correct?

Definitely, based on the pymc4. And I found some gaps between pymc4 and 3, different APIs, different usages, etc. But I'll try my best ヾ(≧▽≦*)o

twiecki commented 1 year ago

Thanks for taking this on @miemiekurisu!

miemiekurisu commented 1 year ago

Update Chapter 5, some codes work, but I'm afraid it needs some review or check = ̄ω ̄=

twiecki commented 1 year ago

@CamDavidsonPilon Can you enable reviewnb for this repo?

miemiekurisu commented 1 year ago

♪(´▽`) Finished Ch1-6 and plan to check codes again. And add some Arviz content to make it look more "pymc4". ★,°:.☆( ̄▽ ̄)/$:.°★

twiecki commented 1 year ago

Once we have reviewnb added looking forward to reviewing!

CamDavidsonPilon commented 1 year ago

I've added reviewnb to the repo. It's my first time using it, so I'm not 100% where it's accessed by others. Can ya'll access this page?

miemiekurisu commented 1 year ago

I've added reviewnb to the repo. It's my first time using it, so I'm not 100% where it's accessed by others. Can ya'll access this page?

Affirmative~ ヾ(•ω•`)o

Slepetys commented 1 year ago

Hi @miemiekurisu Miemiekurisu,

I restarted reading Davidson-Pilon book last weekend, in parallel with Oswaldo Martin´s book, and both were written with previous versions of PyMC and I was struggling to replicate the results with the current code until I found your fork.

Thank you very much for the effort! And also for adding some Arviz steps, which since PyMC3 makes the data analysis and model development check much easier.

Running it locally or even in Colab, I realized that your running time in the sampling step, even using exactly the same sampler and settings was much faster than mine, do you have any advice on how to speed up it?

Thanks

miemiekurisu commented 1 year ago

@Slepetys Hi,glad you found it helpful q(≧▽≦q) I'm not so sure about the speed difference, maybe it is the hardware difference? I just use i3 12th gen to do this work. To be honest, I think it's so so slow in some cases.

I provide my hardware brief below:

OS: Ubuntu 22.04.1 LTS x86_64 Kernel: 5.15.0-46-generic Shell: bash 5.1.16 CPU: 12th Gen Intel i3-12100 (8) @ 5.500GHz GPU: Intel Device 4692 Memory: 6280MiB / 15744MiB

review-notebook-app[bot] commented 1 year ago

View / edit / reply to this conversation on ReviewNB

twiecki commented on 2022-09-30T13:18:45Z ----------------------------------------------------------------

This should be replaced by parameter.initval.


miemiekurisu commented on 2022-11-08T09:05:14Z ----------------------------------------------------------------

Yeah, you're right, and in fact I've noticed this initval and test_value problem when I upgrade it to pymc4.

According to this URL: https://github.com/pymc-devs/pymc/issues/562#issuecomment-932146862

test_val is a misusing, initval parameter should be used.

I try to keep the original content as much as possible at first, so I used the

aesara.config.compute_test_value = 'warn' 

to keep compatibility.

Maybe I should add some brif comments to explain this problem to previous version readers?