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.72k stars 7.88k forks source link

Ch2&Ch3 - I got every trace with the number of several times draws #419

Closed EmpRamses closed 4 years ago

EmpRamses commented 5 years ago

In chapter 3, the last cell warns me that "ValueError: x and y must have same first dimension, but have shapes (50000,) and (275000,)"

In the book, the first dim. of. every trace is equal to the num. of draws as pictures showed bellow.

2018-11-15 10 00 33 2018-11-15 10 00 49

However, in my experiment with codes in the book, I got trace with much more 1st dim. For instance, in. chapter 3, when I want to sample 4 vars for 25000 draws, I got traces with 100000(4 * draws) as 1st dim. ch3

star-yar commented 4 years ago

This happens because the number of chains in sampler = 2 by default. So you get 2 * n draws. Details in discussion https://github.com/pymc-devs/pymc3/pull/2743.