Skip to content

Commit f7c234f

Browse files
committed
update setparams_varinfo!! for MH
1 parent 444f061 commit f7c234f

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/mcmc/gibbs.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -540,14 +540,11 @@ function setparams_varinfo!!(model, ::Sampler, state, params::AbstractVarInfo)
540540
end
541541

542542
function setparams_varinfo!!(
543-
model::DynamicPPL.Model,
544-
sampler::Sampler{<:MH},
545-
state::AbstractVarInfo,
546-
params::AbstractVarInfo,
543+
model::DynamicPPL.Model, sampler::Sampler{<:MH}, state::MHState, params::AbstractVarInfo
547544
)
548-
# The state is already a VarInfo, so we can just return `params`, but first we need to
549-
# update its logprob.
550-
return last(DynamicPPL.evaluate!!(model, params))
545+
# Re-evaluate to update the logprob.
546+
new_vi = last(DynamicPPL.evaluate!!(model, params))
547+
return MHState(new_vi, DynamicPPL.getlogjoint_internal(new_vi))
551548
end
552549

553550
function setparams_varinfo!!(

0 commit comments

Comments
 (0)