This might be a naïve and somewhat obvious question. Let’s say I have a model with global and local variables, for instance LDA with topics (global) and topic distribution for given documents (local). After I run inference and find an approximate posterior distribution, how do we use that posterior distribution in pyro to analyze new documents? For instance, how can I find the topic distribution of a new document?

This depends on the structure of your guide.

- If your guide learns local variables via SVI, then you’ll need to use SVI again to learn local variables on new data. This is slow.
- If you’ve trained a neural guide to do amortized inference, then this inference network should be able to cheaply predict new topics from new data.
- More generally any custom inference method inside the guide should be able to serve predictions on new data.

1 Like

Hi, I have a question about the SVI case.

Which one is correct in Pyro?

Should i

- take the new documents as a new minibatch and continue to run SVI on it, or
- build a new model with the priors of the global variables replaced by their posteriors and only inference the local variables?

From what I understand, it seems one has to build a new model with the global priors replaced with posteriors.

Sorry, I met the same question and didn’t figure it out yet. Did you succeed? If so, can you share some examples? Thanks!