I was going through the Dirichlet Process Mixture Models in Pyro — Pyro Tutorials 1.9.0 documentation, and realized that the dimensions of the parameters in the model and the guide do not match?
The parameter beta
in the guide is drawn from Beta(torch.ones(T-1), kappa) where kappa is a T-1 dimensional tensor itself (which makes sense for the Dirichlet process).
However, in the model, beta
is drawn from Beta(1, alpha) which will just return a single value.
How does this work?
in the model beta
is in a plate that will effectively broadcast out the shape to be (T-1,)
Isn’t the beta in the plate even in the guide?
In model:
with pyro.plate("beta_plate", T-1):
beta = pyro.sample("beta", Beta(1, alpha))
In guide:
with pyro.plate("beta_plate", T-1):
q_beta = pyro.sample("beta", Beta(torch.ones(T-1), kappa))
Or are the two different?
i don’t understand your question. in the context of variational inference sample
statements in the model
define prior distributions. sample
statements in the guide
define approximate posterior distributions over the corresponding latent variable.
Sorry for the ambiguity.
What I meant was - the beta
sample should have the same dimension in both model and guide, right?
both beta
in the model and guide have shape (T-1,)