-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove hmc.jl
and mh.jl
in light of upstreamed "getparams" into AbstractMCMC
#2367
Comments
Some notes for completion of the second itemOne can already use julia> using Turing; using AdvancedHMC: AdvancedHMC; using ADTypes
julia> model = Turing.DynamicPPL.TestUtils.DEMO_MODELS[1]
DynamicPPL.Model{typeof(DynamicPPL.TestUtils.demo_dot_assume_dot_observe), (:x, Symbol("##arg#269")), (), (), Tuple{Vector{Float64}, DynamicPPL.TypeWrap{Vector{Float64}}}, Tuple{}, DynamicPPL.DefaultContext}(DynamicPPL.TestUtils.demo_dot_assume_dot_observe, (x = [1.5, 2.0], var"##arg#269" = DynamicPPL.TypeWrap{Vector{Float64}}()), NamedTuple(), DynamicPPL.DefaultContext())
julia> spl = externalsampler(AdvancedHMC.HMC(0.2, 30); adtype=AutoForwardDiff())
Turing.Inference.ExternalSampler{AdvancedHMC.HMC{AdvancedHMC.Leapfrog{Float64}, Symbol}, AutoForwardDiff{nothing, Nothing}, true}(AdvancedHMC.HMC{AdvancedHMC.Leapfrog{Float64}, Symbol}(30, Leapfrog(ϵ=0.2), :diagonal), AutoForwardDiff())
julia> sample(model, spl, 10)
Sampling 100%|██████████████████████████████████████████| Time:
....
The mechanism is as follows: at the end of the So we should be able to move the HMC (NUTS, etc.) and MH samplers that are current in That being said, we need to be particularly care about the differences in the interface of Turing's API and API of AdvancedHMC (and AdvancedMH). E.g. NUTS(Turing AdvancedHMC), i.e. Turing provides some default arguments. |
After the merging of TuringLang/AbstractMCMC.jl#86. We can start removing HMC and MH samplers to using
ExternalSampler
interface.This would involve following steps:
getparams
andsetparams!!
implementation inAdvacnedHMC
andAdvancedMH
HMC(...; adtype)
in Turing asexternalsampler(AdvancedHMC.hmc(...); adtype)
The text was updated successfully, but these errors were encountered: