This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# x=1: 袋a, x=0: 袋b | |
# y=1: 赤玉, y=0: 白玉 | |
def ball_model_no_if(): | |
x = pyro.sample("x", dist.Bernoulli(0.5)) | |
# xの値に応じてyの割合を変更 | |
y = pyro.sample("y", dist.Bernoulli(2.0/3.0)) * x + pyro.sample("y", dist.Bernoulli(1.0/4.0)) * (1 - x) | |
return y | |
# plateを用いてi.i.dサンプリング | |
with pyro.plate("plate", size=10000): |
OlderNewer