MCMC vs SVI

Dear Pyro Team,

I’ve recently started following Pyro tutorials and learning the language. When I apply SVI and MCMC to my own data sets, I notice the following: MCMC always comes close to the ‘true’ values of the inferred model parameters, and SVI may come close but is sometimes way off. As I have understood, SVI is to mitigate the computational expenses of doing MCMC.

Can you help me with a systematic way of finding the right priors and other settings for SVI, so that the inference comes close to the ‘true’ values of parameters without MCMC. In certain situations, especially with large models, I do not have the luxury of being able to check whether I am close to the ‘true’ values.

It seems strange to me if I would always need MCMC to make reasonably accurate inference.

How can I post an example code with two small csv-files with some data?

Because SVI is an approximate method, you can construct a more sophisticated guide to improve its performance. I am not sure if there is a general approach to construct a “good” guide. In Pyro, we provide several autoguides such as AutoLowRankMultivariateNormal or AutoNormalizingFlow, which can be helpful for your purpose.

I think you can use gist to store your data if it is small, or you can put them in dictionary variables if the number of data point is very small.

Thank you for your answer, I have read the documentation. A quote:

"Usage:

transform_init = partial(iterated, block_autoregressive,
repeats=2)
guide = AutoNormalizingFlow(model, transform_init)
svi = SVI(model, guide, …)

"

It is not clear to me what is meant by this code and where I can find background information. Where does ‘partial’ come from? What is the prerequisite knowledge?