Skip to content

Commit

Permalink
Find step_size if zero (#348)
Browse files Browse the repository at this point in the history
* 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 <tor.erlend95@gmail.com>

* reuse some code.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tor Erlend Fjelde <tor.erlend95@gmail.com>
  • Loading branch information
3 people authored Sep 4, 2023
1 parent 3b6351f commit 1dff529
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "AdvancedHMC"
uuid = "0bf59076-c3b1-5ca4-86bd-e02cd72cde3d"
version = "0.5.4"
version = "0.5.5"

[deps]
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
Expand Down
12 changes: 10 additions & 2 deletions src/abstractmcmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@ function make_step_size(
hamiltonian::Hamiltonian,
init_params,
)
return spl.κ.τ.integrator.ϵ
T = typeof(spl.κ.τ.integrator.ϵ)
ϵ = make_step_size(rng, spl.κ.τ.integrator, T, hamiltonian, init_params)
return ϵ
end

function make_step_size(
Expand All @@ -294,7 +296,13 @@ function make_step_size(
hamiltonian::Hamiltonian,
init_params,
)
return integrator.ϵ
if integrator.ϵ > 0
ϵ = integrator.ϵ
else
ϵ = find_good_stepsize(rng, hamiltonian, init_params)
@info string("Found initial step size ", ϵ)
end
return T(ϵ)
end

function make_step_size(
Expand Down

2 comments on commit 1dff529

@yebai
Copy link
Member Author

@yebai yebai commented on 1dff529 Sep 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/90797

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.5 -m "<description of version>" 1dff529a6d278ee8acfb476699e3ac925bf9467d
git push origin v0.5.5

Please sign in to comment.