From 7175c1dce0a1392ae7b671738140b7bd50db8b60 Mon Sep 17 00:00:00 2001 From: jaimerz Date: Mon, 24 Jul 2023 12:31:30 +0100 Subject: [PATCH 01/19] bump compat of AdvancedHMC --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 7af36c4e5..0f3836c71 100644 --- a/Project.toml +++ b/Project.toml @@ -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, 5" AdvancedMH = "0.6.8, 0.7" AdvancedPS = "0.4" AdvancedVI = "0.2" From 5e2ed5a6ab39c1a1f8dcc3cdcaf4882286c03d3c Mon Sep 17 00:00:00 2001 From: Jaime RZ Date: Thu, 27 Jul 2023 16:30:55 +0100 Subject: [PATCH 02/19] Update Project.toml Co-authored-by: David Widmann --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 0f3836c71..03c632d1c 100644 --- a/Project.toml +++ b/Project.toml @@ -38,7 +38,7 @@ Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" [compat] AbstractMCMC = "4" -AdvancedHMC = "0.3.0, 0.4, 5" +AdvancedHMC = "0.3.0, 0.4, 0.5" AdvancedMH = "0.6.8, 0.7" AdvancedPS = "0.4" AdvancedVI = "0.2" From 9e130d24416b12006c2332e1ba4725867f89a6c5 Mon Sep 17 00:00:00 2001 From: jaimerz Date: Thu, 27 Jul 2023 18:42:25 +0100 Subject: [PATCH 03/19] upd make_ahmc_kernel --- src/inference/hmc.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/inference/hmc.jl b/src/inference/hmc.jl index 5ba383148..a50088df4 100644 --- a/src/inference/hmc.jl +++ b/src/inference/hmc.jl @@ -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(Trajectory{MultinomialTS}(AHMC.Leapfrog(ϵ), GeneralisedNoUTurn(alg.max_depth, alg.Δ_max))) #### #### Compiler interface, i.e. tilde operators. From ebeade810255044a9a5e005d388c86ad3fedcb4b Mon Sep 17 00:00:00 2001 From: jaimerz Date: Fri, 28 Jul 2023 10:13:12 +0100 Subject: [PATCH 04/19] bugs --- src/inference/hmc.jl | 2 +- test/contrib/inference/abstractmcmc.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/inference/hmc.jl b/src/inference/hmc.jl index a50088df4..7e21e36ff 100644 --- a/src/inference/hmc.jl +++ b/src/inference/hmc.jl @@ -445,7 +445,7 @@ 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.HMCKernel(Trajectory{MultinomialTS}(AHMC.Leapfrog(ϵ), GeneralisedNoUTurn(alg.max_depth, alg.Δ_max))) + AHMC.HMCKernel(AHMC.Trajectory{MultinomialTS}(AHMC.Leapfrog(ϵ), GeneralisedNoUTurn(alg.max_depth, alg.Δ_max))) #### #### Compiler interface, i.e. tilde operators. diff --git a/test/contrib/inference/abstractmcmc.jl b/test/contrib/inference/abstractmcmc.jl index 691130635..7191c343c 100644 --- a/test/contrib/inference/abstractmcmc.jl +++ b/test/contrib/inference/abstractmcmc.jl @@ -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 = HMCKernel(Trajectory{MultinomialTS}(integrator, GeneralisedNoUTurn())) adaptor = AdvancedHMC.StanHMCAdaptor( AdvancedHMC.MassMatrixAdaptor(metric), AdvancedHMC.StepSizeAdaptor(0.65, integrator) From 3045bb2a286a27e2ae356145310897d1fe0d958f Mon Sep 17 00:00:00 2001 From: jaimerz Date: Fri, 28 Jul 2023 12:07:43 +0100 Subject: [PATCH 05/19] bugs --- src/inference/hmc.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inference/hmc.jl b/src/inference/hmc.jl index 7e21e36ff..1b95a601f 100644 --- a/src/inference/hmc.jl +++ b/src/inference/hmc.jl @@ -445,7 +445,7 @@ 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.HMCKernel(AHMC.Trajectory{MultinomialTS}(AHMC.Leapfrog(ϵ), GeneralisedNoUTurn(alg.max_depth, alg.Δ_max))) + AHMC.HMCKernel(AHMC.Trajectory{AHMC.MultinomialTS}(AHMC.Leapfrog(ϵ), AHMC.GeneralisedNoUTurn(alg.max_depth, alg.Δ_max))) #### #### Compiler interface, i.e. tilde operators. From a6838c1f83edd3525b56ee41f6ceb272fb10cd2b Mon Sep 17 00:00:00 2001 From: jaimerz Date: Fri, 28 Jul 2023 14:11:04 +0100 Subject: [PATCH 06/19] bug --- test/contrib/inference/abstractmcmc.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/contrib/inference/abstractmcmc.jl b/test/contrib/inference/abstractmcmc.jl index 7191c343c..03371287d 100644 --- a/test/contrib/inference/abstractmcmc.jl +++ b/test/contrib/inference/abstractmcmc.jl @@ -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 = HMCKernel(Trajectory{MultinomialTS}(integrator, GeneralisedNoUTurn())) + proposal = AdvancedHMC.HMCKernel(AdvancedHMC.Trajectory{AdvancedHMC.MultinomialTS}(integrator, AdvancedHMC.GeneralisedNoUTurn())) adaptor = AdvancedHMC.StanHMCAdaptor( AdvancedHMC.MassMatrixAdaptor(metric), AdvancedHMC.StepSizeAdaptor(0.65, integrator) From d8ccd8d086b11c9598249d2edf56c33663bce996 Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Fri, 28 Jul 2023 23:38:22 +0100 Subject: [PATCH 07/19] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 7524f2d36..a91d863e8 100644 --- a/Project.toml +++ b/Project.toml @@ -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" From 8f518980f80d42bdc56f01c07e00d932dc006e3c Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Sat, 29 Jul 2023 01:17:15 +0100 Subject: [PATCH 08/19] Update Inference.jl --- src/inference/Inference.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/inference/Inference.jl b/src/inference/Inference.jl index 73f190dcc..b41cecd12 100644 --- a/src/inference/Inference.jl +++ b/src/inference/Inference.jl @@ -190,9 +190,9 @@ function AbstractMCMC.sample( ) if resume_from === nothing return AbstractMCMC.mcmcsample(rng, model, sampler, N; - chain_type=chain_type, progress=progress, kwargs...) + n_adapts::Int = min(div(N, 10), 1_000), chain_type=chain_type, progress=progress, kwargs...) else - return resume(resume_from, N; chain_type=chain_type, progress=progress, kwargs...) + return resume(resume_from, N; n_adapts = 0, chain_type=chain_type, progress=progress, kwargs...) end end From 05811749bfb543c218f1a68adcbdc4cfafc4a101 Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Sat, 29 Jul 2023 01:40:36 +0100 Subject: [PATCH 09/19] Update Inference.jl --- src/inference/Inference.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inference/Inference.jl b/src/inference/Inference.jl index b41cecd12..1270fabfc 100644 --- a/src/inference/Inference.jl +++ b/src/inference/Inference.jl @@ -190,7 +190,7 @@ function AbstractMCMC.sample( ) if resume_from === nothing return AbstractMCMC.mcmcsample(rng, model, sampler, N; - n_adapts::Int = min(div(N, 10), 1_000), chain_type=chain_type, progress=progress, kwargs...) + n_adapts = min(div(N, 10), 1_000), chain_type=chain_type, progress=progress, kwargs...) else return resume(resume_from, N; n_adapts = 0, chain_type=chain_type, progress=progress, kwargs...) end From bbd890ce16bea4cdf32fa6f7142f9eac56abc55b Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Sat, 29 Jul 2023 08:29:29 +0100 Subject: [PATCH 10/19] Apply suggestions from code review Co-authored-by: David Widmann --- Project.toml | 2 +- src/inference/Inference.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index a91d863e8..3256efd51 100644 --- a/Project.toml +++ b/Project.toml @@ -38,7 +38,7 @@ Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" [compat] AbstractMCMC = "4" -AdvancedHMC = "0.3.0, 0.4, 0.5" +AdvancedHMC = "0.5.2" AdvancedMH = "0.6.8, 0.7" AdvancedPS = "0.4" AdvancedVI = "0.2" diff --git a/src/inference/Inference.jl b/src/inference/Inference.jl index 1270fabfc..5d39de342 100644 --- a/src/inference/Inference.jl +++ b/src/inference/Inference.jl @@ -189,7 +189,7 @@ function AbstractMCMC.sample( kwargs... ) if resume_from === nothing - return AbstractMCMC.mcmcsample(rng, model, sampler, N; + return AbstractMCMC.mcmcsample(rng, model, sampler, N + n_nadapts; n_adapts = min(div(N, 10), 1_000), chain_type=chain_type, progress=progress, kwargs...) else return resume(resume_from, N; n_adapts = 0, chain_type=chain_type, progress=progress, kwargs...) From 476f90c39a428c6a43316d9e1b8fac2a55377647 Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Sat, 29 Jul 2023 08:31:09 +0100 Subject: [PATCH 11/19] Update src/inference/Inference.jl --- src/inference/Inference.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inference/Inference.jl b/src/inference/Inference.jl index 5d39de342..d03831b75 100644 --- a/src/inference/Inference.jl +++ b/src/inference/Inference.jl @@ -189,7 +189,7 @@ function AbstractMCMC.sample( kwargs... ) if resume_from === nothing - return AbstractMCMC.mcmcsample(rng, model, sampler, N + n_nadapts; + return AbstractMCMC.mcmcsample(rng, model, sampler, N + min(div(N, 10), 1_000); n_adapts = min(div(N, 10), 1_000), chain_type=chain_type, progress=progress, kwargs...) else return resume(resume_from, N; n_adapts = 0, chain_type=chain_type, progress=progress, kwargs...) From 1ade2fd7331839917c7f09147b18b17573cd223a Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Sat, 29 Jul 2023 13:55:26 +0100 Subject: [PATCH 12/19] Update Inference.jl --- src/inference/Inference.jl | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/inference/Inference.jl b/src/inference/Inference.jl index d03831b75..e3c00b2d1 100644 --- a/src/inference/Inference.jl +++ b/src/inference/Inference.jl @@ -187,12 +187,33 @@ function AbstractMCMC.sample( resume_from=nothing, progress=PROGRESS[], kwargs... -) +) + if resume_from === nothing + return AbstractMCMC.mcmcsample(rng, model, sampler, N + default_n_adapts; + chain_type=chain_type, progress=progress, kwargs...) + else + return resume(resume_from, N; chain_type=chain_type, progress=progress, kwargs...) + end +end + +function AbstractMCMC.sample( + rng::AbstractRNG, + model::AbstractModel, + sampler::sampler_wrapper::Sampler{<:ExternalSampler}; + N::Integer; + chain_type=MCMCChains.Chains, + resume_from=nothing, + progress=PROGRESS[], + kwargs... +) if resume_from === nothing - return AbstractMCMC.mcmcsample(rng, model, sampler, N + min(div(N, 10), 1_000); - n_adapts = min(div(N, 10), 1_000), chain_type=chain_type, progress=progress, kwargs...) + default_n_adapts = min(div(N, 10), 1_000) + kwargs[:n_adapts] = get(kwargs, :n_adapts, default_n_adapts) + kwargs[:discard_initial] = get(kwargs, :discard_initial, default_n_adapts) + return AbstractMCMC.mcmcsample(rng, model, sampler, N + default_n_adapts; + chain_type=chain_type, progress=progress, kwargs...) else - return resume(resume_from, N; n_adapts = 0, chain_type=chain_type, progress=progress, kwargs...) + return resume(resume_from, N; chain_type=chain_type, progress=progress, kwargs...) end end From b3b1d33972ddacb21f58ae63912a216eb7c2ef96 Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Sat, 29 Jul 2023 14:01:48 +0100 Subject: [PATCH 13/19] Update Inference.jl --- src/inference/Inference.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inference/Inference.jl b/src/inference/Inference.jl index e3c00b2d1..1f0132688 100644 --- a/src/inference/Inference.jl +++ b/src/inference/Inference.jl @@ -189,7 +189,7 @@ function AbstractMCMC.sample( kwargs... ) if resume_from === nothing - return AbstractMCMC.mcmcsample(rng, model, sampler, N + default_n_adapts; + return AbstractMCMC.mcmcsample(rng, model, sampler, N; chain_type=chain_type, progress=progress, kwargs...) else return resume(resume_from, N; chain_type=chain_type, progress=progress, kwargs...) From 05a2dba3b52edf65f9917fe984cc280822cbc5ab Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Sat, 29 Jul 2023 14:06:49 +0100 Subject: [PATCH 14/19] Update Inference.jl --- src/inference/Inference.jl | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/inference/Inference.jl b/src/inference/Inference.jl index 1f0132688..bd631eb7b 100644 --- a/src/inference/Inference.jl +++ b/src/inference/Inference.jl @@ -181,36 +181,30 @@ end function AbstractMCMC.sample( rng::AbstractRNG, model::AbstractModel, - sampler::Sampler{<:InferenceAlgorithm}, + alg::ExternalSampler, N::Integer; - chain_type=MCMCChains.Chains, - resume_from=nothing, - progress=PROGRESS[], kwargs... -) - if resume_from === nothing - return AbstractMCMC.mcmcsample(rng, model, sampler, N; - chain_type=chain_type, progress=progress, kwargs...) - else - return resume(resume_from, N; chain_type=chain_type, progress=progress, kwargs...) - end +) + # Default adaption settings for external samplers + default_n_adapts = min(div(N, 10), 1_000) + kwargs[:n_adapts] = get(kwargs, :n_adapts, default_n_adapts) + kwargs[:discard_initial] = get(kwargs, :discard_initial, default_n_adapts) + + return AbstractMCMC.sample(rng, model, Sampler(alg, model), N; kwargs...) end function AbstractMCMC.sample( rng::AbstractRNG, model::AbstractModel, - sampler::sampler_wrapper::Sampler{<:ExternalSampler}; + sampler::Sampler{<:InferenceAlgorithm}, N::Integer; chain_type=MCMCChains.Chains, resume_from=nothing, progress=PROGRESS[], kwargs... -) +) if resume_from === nothing - default_n_adapts = min(div(N, 10), 1_000) - kwargs[:n_adapts] = get(kwargs, :n_adapts, default_n_adapts) - kwargs[:discard_initial] = get(kwargs, :discard_initial, default_n_adapts) - return AbstractMCMC.mcmcsample(rng, model, sampler, N + default_n_adapts; + return AbstractMCMC.mcmcsample(rng, model, sampler, N; chain_type=chain_type, progress=progress, kwargs...) else return resume(resume_from, N; chain_type=chain_type, progress=progress, kwargs...) From 1125f7222a23558626f578322fdb404b6a5a7454 Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Sat, 29 Jul 2023 14:07:15 +0100 Subject: [PATCH 15/19] Update Project.toml --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 3256efd51..ae21f7286 100644 --- a/Project.toml +++ b/Project.toml @@ -38,7 +38,7 @@ Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" [compat] AbstractMCMC = "4" -AdvancedHMC = "0.5.2" +AdvancedHMC = "0.3.0, 0.4.0, 0.5.2" AdvancedMH = "0.6.8, 0.7" AdvancedPS = "0.4" AdvancedVI = "0.2" From a1fcb21e313aefb163ba9ee29591e3174c4fa80e Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Sat, 29 Jul 2023 14:13:50 +0100 Subject: [PATCH 16/19] Update Inference.jl --- src/inference/Inference.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inference/Inference.jl b/src/inference/Inference.jl index bd631eb7b..679f5639e 100644 --- a/src/inference/Inference.jl +++ b/src/inference/Inference.jl @@ -190,7 +190,7 @@ function AbstractMCMC.sample( kwargs[:n_adapts] = get(kwargs, :n_adapts, default_n_adapts) kwargs[:discard_initial] = get(kwargs, :discard_initial, default_n_adapts) - return AbstractMCMC.sample(rng, model, Sampler(alg, model), N; kwargs...) + return AbstractMCMC.sample(rng, model, Sampler(alg, model), N + default_n_adapts; kwargs...) end function AbstractMCMC.sample( From 6838b4e88baf4112770a1923c5f5f733da27640c Mon Sep 17 00:00:00 2001 From: Hong Ge Date: Sat, 29 Jul 2023 15:08:17 +0100 Subject: [PATCH 17/19] Typofix in test. --- test/contrib/inference/abstractmcmc.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/contrib/inference/abstractmcmc.jl b/test/contrib/inference/abstractmcmc.jl index 03371287d..b2b270e66 100644 --- a/test/contrib/inference/abstractmcmc.jl +++ b/test/contrib/inference/abstractmcmc.jl @@ -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 ) From 307040e7819489ad27c9ef8adcea2847e37be467 Mon Sep 17 00:00:00 2001 From: Hong Ge Date: Sat, 29 Jul 2023 15:19:08 +0100 Subject: [PATCH 18/19] Implement sample for external spl + ensemble --- src/inference/Inference.jl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/inference/Inference.jl b/src/inference/Inference.jl index 679f5639e..317812baf 100644 --- a/src/inference/Inference.jl +++ b/src/inference/Inference.jl @@ -254,6 +254,24 @@ function AbstractMCMC.sample( kwargs...) end +function AbstractMCMC.sample( + rng::AbstractRNG, + model::AbstractModel, + alg::ExternalSampler, + ensemble::AbstractMCMC.AbstractMCMCEnsemble, + N::Integer, + n_chains::Integer; + kwargs... +) + # Default adaption settings for external samplers + default_n_adapts = min(div(N, 10), 1_000) + kwargs[:n_adapts] = get(kwargs, :n_adapts, default_n_adapts) + kwargs[:discard_initial] = get(kwargs, :discard_initial, default_n_adapts) + + return AbstractMCMC.sample(rng, model, Sampler(alg, model), ensemble, N, n_chains; + kwargs...) +end + function AbstractMCMC.sample( rng::AbstractRNG, model::AbstractModel, From 2bf8beb638122191f6e8a9626d900209c0ded008 Mon Sep 17 00:00:00 2001 From: Hong Ge <3279477+yebai@users.noreply.github.com> Date: Sat, 29 Jul 2023 15:39:11 +0100 Subject: [PATCH 19/19] Revert default n_adapts value. --- src/inference/Inference.jl | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/src/inference/Inference.jl b/src/inference/Inference.jl index 317812baf..73f190dcc 100644 --- a/src/inference/Inference.jl +++ b/src/inference/Inference.jl @@ -178,21 +178,6 @@ function AbstractMCMC.sample( return AbstractMCMC.sample(rng, model, Sampler(alg, model), N; kwargs...) end -function AbstractMCMC.sample( - rng::AbstractRNG, - model::AbstractModel, - alg::ExternalSampler, - N::Integer; - kwargs... -) - # Default adaption settings for external samplers - default_n_adapts = min(div(N, 10), 1_000) - kwargs[:n_adapts] = get(kwargs, :n_adapts, default_n_adapts) - kwargs[:discard_initial] = get(kwargs, :discard_initial, default_n_adapts) - - return AbstractMCMC.sample(rng, model, Sampler(alg, model), N + default_n_adapts; kwargs...) -end - function AbstractMCMC.sample( rng::AbstractRNG, model::AbstractModel, @@ -254,24 +239,6 @@ function AbstractMCMC.sample( kwargs...) end -function AbstractMCMC.sample( - rng::AbstractRNG, - model::AbstractModel, - alg::ExternalSampler, - ensemble::AbstractMCMC.AbstractMCMCEnsemble, - N::Integer, - n_chains::Integer; - kwargs... -) - # Default adaption settings for external samplers - default_n_adapts = min(div(N, 10), 1_000) - kwargs[:n_adapts] = get(kwargs, :n_adapts, default_n_adapts) - kwargs[:discard_initial] = get(kwargs, :discard_initial, default_n_adapts) - - return AbstractMCMC.sample(rng, model, Sampler(alg, model), ensemble, N, n_chains; - kwargs...) -end - function AbstractMCMC.sample( rng::AbstractRNG, model::AbstractModel,