Skip to content

Question: MCMChain after VI sampling #2462

Closed
@stefanocovino

Description

@stefanocovino

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions