diff --git a/tutorials/variational-inference/index.qmd b/tutorials/variational-inference/index.qmd index 3ad3be5de..cd814b156 100755 --- a/tutorials/variational-inference/index.qmd +++ b/tutorials/variational-inference/index.qmd @@ -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`: