facebookresearch / beanmachine

A library that allows for inference on probabilistic models
https://beanmachine.org/
MIT License
265 stars 49 forks source link

Accessing params in SVI #1624

Open zaxtax opened 2 years ago

zaxtax commented 2 years ago

Right now, there isn't a great way to access the params directly associated with a given guide program. Is this a deliberate design choice, or do we want to expose this functionality somehow?

feynmanliang commented 2 years ago

I think this is a good suggestion and it comes up in a few of my use cases. Suppose I have a guide random variable q() for some target p(). As an implementer of a VI algorithm, how can I obtain all the params used in q() so that I can construct an optimizer over them?

There's no convenient or straightforward way ATM IMO. We currently trace them in VariationalInfer's constructor, but maybe there's an alternative we could look at?