Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: MCMChain after VI sampling #2462

Open
stefanocovino opened this issue Jan 13, 2025 · 0 comments
Open

Question: MCMChain after VI sampling #2462

stefanocovino opened this issue Jan 13, 2025 · 0 comments
Labels

Comments

@stefanocovino
Copy link

Question on: https://github.com/TuringLang/Turing.jl/edit/master/docs/_tutorials/09_variational-inference.md

Actually, it is simply a suggestion rather than a question. In the tutorial, it is shown how to generate a plot of the posterior after having carried out a VI analysis. However, alternatively, it is possible to convert the obtained sample to a MCMChains object and plot the posterior with StatsPlots, PairPlots or, in general, use various tools suited to MCMC chains.

The syntax is really simple. If "sample" is the result of VI analysis, one can have a MCMCChains as:

chain = Chains(sample',[varname1, varname2...])

Where the list of model parameters can be obtained as already shown in the tutorial or even by DynamicPPL.syms(DynamicPPL.VarInfo(m)), if "m" is the Turing model.

I think it could be good having this possibility mentioned in the tutorial.

@mhauru mhauru added the doc label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants