From 1e52cd0b64f0f6736b5dc7c3c21925a55d096966 Mon Sep 17 00:00:00 2001 From: Tor Erlend Fjelde Date: Mon, 23 Sep 2024 12:45:31 +0100 Subject: [PATCH 1/3] Added test for ambiguity --- test/runtests.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 59ba7d4..8c4f4fa 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -271,6 +271,15 @@ include("util.jl") σ² = 1e-3 spl1 = MALA(x -> MvNormal((σ² / 2) .* x, σ² * I)) + # Without `initial_params` this should error. + @test_throws ErrorException sample( + model, spl1, 1000; + chain_type=StructArray, + param_names=["μ", "σ"], + discard_initial=100, + progress=false + ) + # Sample from the posterior with initial parameters. chain1 = sample( model, spl1, 1000; From 9c61b360017779b2fffdcd6553f2084908d31b47 Mon Sep 17 00:00:00 2001 From: Tor Erlend Fjelde Date: Mon, 23 Sep 2024 12:46:18 +0100 Subject: [PATCH 2/3] Fixed ambiguity --- src/MALA.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MALA.jl b/src/MALA.jl index b2fe402..7c260c7 100644 --- a/src/MALA.jl +++ b/src/MALA.jl @@ -20,7 +20,7 @@ end logdensity(model::DensityModelOrLogDensityModel, t::GradientTransition) = t.lp -propose(rng::Random.AbstractRNG, ::MALA, model) = error("please specify initial parameters") +propose(::Random.AbstractRNG, ::MALA, ::DensityModelOrLogDensityModel) = error("please specify initial parameters") function transition(sampler::MALA, model::DensityModelOrLogDensityModel, params, accepted) return GradientTransition(params, logdensity_and_gradient(model, params)..., accepted) end From 0e1538f63b1fef1eb20f5d72edbdd875d052bd6c Mon Sep 17 00:00:00 2001 From: Tor Erlend Fjelde Date: Mon, 23 Sep 2024 12:47:08 +0100 Subject: [PATCH 3/3] Bump patch version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index f4c1771..bb95eea 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "AdvancedMH" uuid = "5b7e9947-ddc0-4b3f-9b55-0d8042f74170" -version = "0.8.2" +version = "0.8.3" [deps] AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001"