Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tutorials/variational-inference/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,13 @@ avg[union(sym2range[:coefficients]...)]

For further convenience, we can wrap the samples into a `Chains` object to summarize the results.
```{julia}
varnames = vcat(["σ²", "intercept"], ["coefficients[$i]" for i in 1:n_vars])
varinf = Turing.DynamicPPL.VarInfo(m)
vns_and_values = Turing.DynamicPPL.varname_and_value_leaves(Turing.DynamicPPL.values_as(varinf, OrderedDict))
varnames = map(first, vns_and_values)
vi_chain = Chains(reshape(z', (size(z,2), size(z,1), 1)), varnames)
```
(Since we're drawing independent samples, we can simply ignore the ESS and Rhat metrics.)
Unfortunately, extracting `varnames` is a bit verbose at the moment, but hopefully will become simpler in the near future.

Let's compare this against samples from `NUTS`:

Expand Down