pyro-ppl / pyro

Deep universal probabilistic programming with Python and PyTorch
http://pyro.ai
Apache License 2.0
8.55k stars 987 forks source link

FR Automatic reparameterization strategies #2883

Open fritzo opened 3 years ago

fritzo commented 3 years ago

As our available reparameterization strategies become increasingly complex and composable, it would be useful to provide some automatic strategies, possibly even enabled by default in autoguides and MCMC.

Maybe this could work with syntax like poutine.reparam(config="auto") or poutine.reparam(config="full").

Proposed automatic strategies

Design questions

eb8680 commented 3 years ago

Should we automatically use these in AutoGuide and MCMC?

Would it also make sense to refactor the automatic transformation to unconstrained space in MCMC and ADVI to use poutine.reparam and an automated "unconstrain" reparameterization strategy?

eb8680 commented 3 years ago

Also, the enumeration strategies are tantalizingly close to being Reparam classes - I wonder if we could actually rewrite them that way and make config_enumerate into a special case of ReparamMessenger.

fritzo commented 3 years ago

Would it also make sense to refactor the automatic transformation to unconstrained space...

Interesting, this seems similar to @fehiepsi's uniform_reparam_transform() in https://github.com/pyro-ppl/numpyro/pull/807. Before we do any major refactoring, I'd like to see what issues come up with the new use cases of automatic reparametrization strategies in #2884. I expect #2884 to uncover design constraints that will inform how reparametrization transforms work more generally.

fehiepsi commented 3 years ago

In NumPyro, we used unconstrained_reparam in HMC. For autoguide, at first, I tried to use that reparam but later decided to follow Pyro implementation because SVI requires a pair of model and (transformed) guide, not reparamed_model and diagonal guide.