Last active
June 26, 2020 23:30
-
-
Save xukai92/528dd7bd828e1a7437af6d62110664ab to your computer and use it in GitHub Desktop.
Generated quantiles with Turing.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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