Skip to content

Commit

Permalink
fix condition
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 committed Nov 14, 2024
1 parent 8e4c022 commit c6db48a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/gibbs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ function AbstractMCMC.step(
param_values = state.values
for vs in keys(state.conditioning_schedule)
model = initialize!(model, param_values)
cond_model = AbstractPPL.condition(
model, vs, model.evaluation_env, state.cached_eval_caches[vs]
)
cond_model = condition(model, vs, model.evaluation_env)
param_values = gibbs_internal(rng, cond_model, state.conditioning_schedule[vs])
end
return param_values,
Expand Down
9 changes: 2 additions & 7 deletions src/model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,7 @@ function settrans(model::BUGSModel, bool::Bool=!(model.transformed))
return BangBang.setproperty!!(model, :transformed, bool)
end

function condition(
model::BUGSModel,
d::Dict{<:VarName,<:Any};
sorted_nodes=Nothing, # support cached sorted Markov blanket nodes
)
function condition(model::BUGSModel, d::Dict{<:VarName,<:Any})
new_evaluation_env = deepcopy(model.evaluation_env)
for (p, value) in d
new_evaluation_env = setindex!!(new_evaluation_env, value, p)
Expand All @@ -362,8 +358,7 @@ end
function condition(
model::BUGSModel,
var_group::Vector{<:VarName},
evaluation_env::NamedTuple=model.evaluation_env;
sorted_nodes=Nothing,
evaluation_env::NamedTuple=model.evaluation_env,
)
check_var_group(var_group, model)
new_parameters = setdiff(model.parameters, var_group)
Expand Down

0 comments on commit c6db48a

Please sign in to comment.