Hi all,
I’m really enjoying playing around with Pyro, but I have a few questions. I see that Pyro now has NUTS and HMC, which is awesome, but I often end up making models with some discrete latents (and variable numbers of discrete latents). I’d like to sample them using some form of MH. I know there is an open PR to implement singlesite MH, but I was wondering about implementing some more general form of MH (e.g. including the RJ correction for introduction of new variables/deletion of variables). Anyway:

I really like the way that Pyro uses models and guides, and the freedom it provides. From my read of the docs, it seems like a guide is not just useful as a variational distribution, but (in principle) could also be an MCMC proposal distribution. So I thought to implement an MH kernel using a guide as a proposal distribution. If I’m doing independent MH, there is no further question. But usually I want to condition my proposal on the current value(s) of the relevant sample site(s)–what’s the best way to do this? The guide and model have by definition the same signature, so I can’t really pass in the current value via the arguments to the guide. Is there some other practical way to do this that would fit nicely in the design of Pyro?

Regarding a more general MH that allows for transdimensional proposals: I’ve implemented these in more specific settings before, but one thing I was wondering is how in general the inference algorithm would “know” what sorts of variables it could introduce. I imagined this would be solved by taking an approach like above–use a guide that defines what sorts of variables could be proposed (leading back to the first question). Is there another reasonable way to do this? I’d imagine not, since running the model forward would sometimes not introduce sample sites that you may want to propose…
If I get a good intuition for the right way to go here, I’d be more than happy to contribute to Pyro if you’d like. Also, if this belongs on the issue tracker instead of the forum, just let me know.
Thanks for your time
Patrick