Skip to content

Commit

Permalink
rename num_adapts to num_unadjusted
Browse files Browse the repository at this point in the history
  • Loading branch information
torfjelde committed May 16, 2024
1 parent def0925 commit 3e333f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/AutomaticMALA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export AutoMALA

struct AutoMALA{T} <: AbstractMCMC.AbstractSampler
ϵ_init::T
num_adapt::Int
num_unadjusted::Int
end

struct AutoMALAState{T1,T2,T3}
Expand All @@ -26,7 +26,7 @@ struct AutoMALAState{T1,T2,T3}
iteration::Int
end

isadapt(sampler::AutoMALA, state::AutoMALAState) = state.iteration < sampler.num_adapt
isunadjusted(sampler::AutoMALA, state::AutoMALAState) = state.iteration < sampler.num_unadjusted

function compute_logprob(model, x, p)
ℓ_x = LogDensityProblems.logdensity(model, x)
Expand Down Expand Up @@ -83,7 +83,7 @@ function AbstractMCMC.step(
# Compute acceptance probability.
logα = lp - lp_prev
# Accept or reject.
isaccept = isadapt(sampler, state) || (j == j_prop && log(rand(rng)) < logα)
isaccept = isunadjusted(sampler, state) || (j == j_prop && log(rand(rng)) < logα)

state_new = if isaccept
AutoMALAState(x, p, lp, a, b, ϵₜ, j, isaccept, state.iteration + 1)
Expand Down

0 comments on commit 3e333f7

Please sign in to comment.