Probabilistic-Programming-and-Bayesian-Methods-for-Hackers
Probabilistic-Programming-and-Bayesian-Methods-for-Hackers copied to clipboard
Ch.3|About the Categorical
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(sample_shape=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?