Skip to content

Commit

Permalink
Remove unnecessary initialisation in Gibbs
Browse files Browse the repository at this point in the history
We were doing work that was already done by the caller of initialstep.
  • Loading branch information
mhauru committed Jan 14, 2025
1 parent be5c70b commit c44d81a
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/mcmc/gibbs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -409,20 +409,14 @@ function DynamicPPL.initialstep(
rng::Random.AbstractRNG,
model::DynamicPPL.Model,
spl::DynamicPPL.Sampler{<:Gibbs},
vi_base::DynamicPPL.AbstractVarInfo;
vi::DynamicPPL.AbstractVarInfo;
initial_params=nothing,
kwargs...,
)
alg = spl.alg
varnames = alg.varnames
samplers = alg.samplers

# Run the model once to get the varnames present + initial values to condition on.
vi = DynamicPPL.VarInfo(rng, model)
if initial_params !== nothing
vi = DynamicPPL.unflatten(vi, initial_params)
end

vi, states = gibbs_initialstep_recursive(
rng, model, varnames, samplers, vi; initial_params=initial_params, kwargs...
)
Expand Down

0 comments on commit c44d81a

Please sign in to comment.