Sorry it is a little difficult for me to understand SVI Part II: Conditional Independence, Subsampling, and Amortization — Pyro Tutorials 1.8.4 documentation .
Copy the paragraph:
def model(data):
# sample f from the beta prior
f = pyro.sample("latent_fairness", dist.Beta(alpha0, beta0))
# loop over the observed data [WE ONLY CHANGE THE NEXT LINE]
for i in pyro.plate("data_loop", len(data)):
# observe datapoint i using the bernoulli likelihood
pyro.sample("obs_{}".format(i), dist.Bernoulli(f), obs=data[i])
At every execution of the body of the for loop we enter a new (conditional) independence context which is then exited at the end of the for loop body. Let’s be very explicit about this:
- because each observed
pyro.samplestatement occurs within a different execution of the body of theforloop, Pyro marks each observation as independent - this independence is properly a conditional independence given
latent_fairnessbecauselatent_fairnessis sampled outside of the context ofdata_loop.
Here , does it means latent_fairness doesn’t change in each for i in pyro.plate("data_loop", len(data)): ?
If I use range , latent_fairness would change along with range loop ?