We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5dbf958 commit 25df39eCopy full SHA for 25df39e
Project.toml
@@ -9,7 +9,7 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
9
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
10
11
[compat]
12
-AbstractMCMC = "0.4, 0.5, 1"
+AbstractMCMC = "1"
13
Distributions = "0.20, 0.21, 0.22, 0.23"
14
Requires = "1.0"
15
julia = "1"
src/AdvancedMH.jl
@@ -1,7 +1,7 @@
1
module AdvancedMH
2
3
# Import the relevant libraries.
4
-import AbstractMCMC
+using AbstractMCMC
5
using Distributions
6
using Requires
7
@@ -11,8 +11,7 @@ import Random
export MetropolisHastings, DensityModel, RWMH, StaticMH, StaticProposal, RandomWalkProposal
# Reexports
-using AbstractMCMC: sample, psample
-export sample, psample
+export sample, MCMCThreads, MCMCDistributed
16
17
# Abstract type for MH-style samplers.
18
abstract type Metropolis <: AbstractMCMC.AbstractSampler end
test/runtests.jl
@@ -53,12 +53,19 @@ using Test
53
@test mean(chain2.σ) ≈ 1.0 atol=0.1
54
end
55
56
- if VERSION >= v"1.3"
57
- @testset "psample" begin
58
- spl1 = StaticMH([Normal(0,1), Normal(0, 1)])
59
- chain1 = psample(model, spl1, 10000, 4; param_names=["μ", "σ"], chain_type=Chains)
60
- @test mean(chain1["μ"].value) ≈ 0.0 atol=0.1
61
- @test mean(chain1["σ"].value) ≈ 1.0 atol=0.1
+ @testset "parallel sampling" begin
+ spl1 = StaticMH([Normal(0,1), Normal(0, 1)])
+
+ chain1 = sample(model, spl1, MCMCDistributed(), 10000, 4;
+ param_names=["μ", "σ"], chain_type=Chains)
+ @test mean(chain1["μ"].value) ≈ 0.0 atol=0.1
62
+ @test mean(chain1["σ"].value) ≈ 1.0 atol=0.1
63
64
+ if VERSION >= v"1.3"
65
+ chain2 = sample(model, spl1, MCMCThreads(), 10000, 4;
66
67
+ @test mean(chain2["μ"].value) ≈ 0.0 atol=0.1
68
+ @test mean(chain2["σ"].value) ≈ 1.0 atol=0.1
69
70
71
0 commit comments