Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generated quantiles with Turing.jl
# Modifed from https://github.com/cambridge-mlg/Covid19/blob/master/src/utils.jl#L79
function generated_quantities(m::Turing.Model, c::MCMCChains.Chains)
# If `c` is multiple chains, we convert them into a single chain
chain = length(chains(c)) == 1 ? c : MCMCChains.pool_chain(c)
vi = Turing.DynamicPPL.VarInfo(m)
return map(1:length(chain)) do i
Turing.DynamicPPL._setval!(vi, chain[i])
m(vi)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment