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

Chapter 1 | Mandatory coin-flip mislabeled prior | TFP version #442

Open arastuie opened 5 years ago

arastuie commented 5 years ago

Hi there,

The first line of the code for the Mandatory coin-flip example creates a random variable as follows: rv_coin_flip_prior = tfp.distributions.Bernoulli(probs=0.5, dtype=tf.int32)

I think the variable name implies that it is the prior of the coin flip, however we know that in this example both the prior and the posterior come from a Beta distribution, not a Bernoulli.

I just think as the first example of a Bayesian approach it can be a bit misleading. Maybe a name like rv_coin_flip_data would be more suitable.

Pindar777 commented 5 years ago

@Makan-Ar I think you are right. Each coin-flip is drawn from a Bernoulli distribution. However, the consecutive draws by which we would like to check the fairness of the coin follow a Beta distribution. Hence this should also be the prior with innovations (and a the log-likelihood) from the Bernoulli distribution.

@CamDavidsonPilon What do you think?