Skip to content

Commit

Permalink
bump compat of AdvancedHMC (#2050)
Browse files Browse the repository at this point in the history
* bump compat of AdvancedHMC

* Update Project.toml

Co-authored-by: David Widmann <devmotion@users.noreply.github.com>

* upd make_ahmc_kernel

* bugs

* bugs

* bug

* Update Project.toml

* Update Inference.jl

* Update Inference.jl

* Apply suggestions from code review

Co-authored-by: David Widmann <devmotion@users.noreply.github.com>

* Update src/inference/Inference.jl

* Update Inference.jl

* Update Inference.jl

* Update Inference.jl

* Update Project.toml

* Update Inference.jl

* Typofix in test.

* Implement sample for external  spl + ensemble

* Revert default n_adapts value.

---------

Co-authored-by: David Widmann <devmotion@users.noreply.github.com>
Co-authored-by: Hong Ge <3279477+yebai@users.noreply.github.com>
Co-authored-by: Hong Ge <hg344@cam.ac.uk>
  • Loading branch information
4 people authored Jul 29, 2023
1 parent 75961e7 commit fa3a6c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Turing"
uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0"
version = "0.27"
version = "0.27.1"

[deps]
AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"
Expand Down Expand Up @@ -38,7 +38,7 @@ Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"

[compat]
AbstractMCMC = "4"
AdvancedHMC = "0.3.0, 0.4"
AdvancedHMC = "0.3.0, 0.4.0, 0.5.2"
AdvancedMH = "0.6.8, 0.7"
AdvancedPS = "0.4"
AdvancedVI = "0.2"
Expand Down
3 changes: 2 additions & 1 deletion src/inference/hmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ end
function make_ahmc_kernel(alg::HMCDA, ϵ)
return AHMC.HMCKernel(AHMC.Trajectory{AHMC.EndPointTS}(AHMC.Leapfrog(ϵ), AHMC.FixedIntegrationTime(alg.λ)))
end
make_ahmc_kernel(alg::NUTS, ϵ) = AHMC.NUTS(AHMC.Leapfrog(ϵ), alg.max_depth, alg.Δ_max)
make_ahmc_kernel(alg::NUTS, ϵ) =
AHMC.HMCKernel(AHMC.Trajectory{AHMC.MultinomialTS}(AHMC.Leapfrog(ϵ), AHMC.GeneralisedNoUTurn(alg.max_depth, alg.Δ_max)))

####
#### Compiler interface, i.e. tilde operators.
Expand Down
4 changes: 2 additions & 2 deletions test/contrib/inference/abstractmcmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function initialize_nuts(model::Turing.Model)
# - multinomial sampling scheme,
# - generalised No-U-Turn criteria, and
# - windowed adaption for step-size and diagonal mass matrix
proposal = AdvancedHMC.NUTS{AdvancedHMC.MultinomialTS,AdvancedHMC.GeneralisedNoUTurn}(integrator)
proposal = AdvancedHMC.HMCKernel(AdvancedHMC.Trajectory{AdvancedHMC.MultinomialTS}(integrator, AdvancedHMC.GeneralisedNoUTurn()))
adaptor = AdvancedHMC.StanHMCAdaptor(
AdvancedHMC.MassMatrixAdaptor(metric),
AdvancedHMC.StepSizeAdaptor(0.65, integrator)
Expand All @@ -50,7 +50,7 @@ end
[model],
DynamicPPL.Sampler(externalsampler(sampler), model),
5_000;
nadapts=1_000,
n_adapts=1_000,
discard_initial=1_000,
rtol=0.2
)
Expand Down

2 comments on commit fa3a6c1

@yebai
Copy link
Member

@yebai yebai commented on fa3a6c1 Jul 29, 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/88624

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.27.1 -m "<description of version>" fa3a6c1ad5d4be0bdcb604ca27ab58154c0f02ce
git push origin v0.27.1

Please sign in to comment.