Skip to content

Commit 6325029

Browse files
committed
Add logevidence to chain
1 parent 2fad97b commit 6325029

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ext/DynamicPPLMCMCChainsExt.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,20 @@ function AbstractMCMC.bundle_samples(
166166
info = merge(info, (start_time=stats.start, stop_time=stats.stop))
167167
end
168168

169+
# Calculate logevidence, if it's available
170+
logevidence = if :logevidence in names(bare_chain)
171+
mean(bare_chain[:logevidence])
172+
else
173+
missing
174+
end
175+
169176
# Reconstruct the chain with the extra information
170177
# Yeah, this is quite ugly. Blame MCMCChains.
171178
chain = MCMCChains.Chains(
172179
bare_chain.value.data,
173180
names(bare_chain),
174181
bare_chain.name_map;
182+
evidence=logevidence,
175183
info=info,
176184
start=discard_initial + 1,
177185
thin=thinning,

0 commit comments

Comments
 (0)