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 ;)
I think the p1 which was printed out might not equal to the one passed to the Categorical function, because the evaluate function was executed twice, which generated different samples of p1. Am i right or wrong?
p1 = tfd.Uniform(name='p', low=0., high=1.).sample() p2 = 1 - p1 p = tf.stack([p1, p2]) assignment = tfd.Categorical(name="assignment", probs=p)
assignment_ = evaluate(assignment.sample(sampleshape=data.shape[0], seed=42))[:10] print("prior assignment, with p = %.2f:" % evaluate(p1)) print("assigment evaluation: \n", assignment_)
I think the p1 which was printed out might not equal to the one passed to the Categorical function, because the evaluate function was executed twice, which generated different samples of p1. Am i right or wrong?