Skip to content

Commit 1dff529

Browse files
yebaigithub-actions[bot]torfjelde
authored
Find step_size if zero (#348)
* Find step_size if zero * Update abstractmcmc.jl * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update Project.toml * Update abstractmcmc.jl * Apply suggestions from code review Co-authored-by: Tor Erlend Fjelde <[email protected]> * reuse some code. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Tor Erlend Fjelde <[email protected]>
1 parent 3b6351f commit 1dff529

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "AdvancedHMC"
22
uuid = "0bf59076-c3b1-5ca4-86bd-e02cd72cde3d"
3-
version = "0.5.4"
3+
version = "0.5.5"
44

55
[deps]
66
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"

src/abstractmcmc.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,9 @@ function make_step_size(
273273
hamiltonian::Hamiltonian,
274274
init_params,
275275
)
276-
return spl.κ.τ.integrator.ϵ
276+
T = typeof(spl.κ.τ.integrator.ϵ)
277+
ϵ = make_step_size(rng, spl.κ.τ.integrator, T, hamiltonian, init_params)
278+
return ϵ
277279
end
278280

279281
function make_step_size(
@@ -294,7 +296,13 @@ function make_step_size(
294296
hamiltonian::Hamiltonian,
295297
init_params,
296298
)
297-
return integrator.ϵ
299+
if integrator.ϵ > 0
300+
ϵ = integrator.ϵ
301+
else
302+
ϵ = find_good_stepsize(rng, hamiltonian, init_params)
303+
@info string("Found initial step size ", ϵ)
304+
end
305+
return T(ϵ)
298306
end
299307

300308
function make_step_size(

0 commit comments

Comments
 (0)