Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/MALA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading