|
58 | 58 | chn1 = sample(gdemo_default, alg1, 5000; save_state=true)
|
59 | 59 | check_gdemo(chn1)
|
60 | 60 |
|
61 |
| - chn1_resumed = Turing.Inference.resume(chn1, 1000) |
| 61 | + chn1_resumed = Turing.Inference.resume(chn1, 2000) |
62 | 62 | check_gdemo(chn1_resumed)
|
63 | 63 |
|
64 | 64 | chn1_contd = sample(gdemo_default, alg1, 5000; resume_from=chn1)
|
|
67 | 67 | chn1_contd2 = sample(gdemo_default, alg1, 5000; resume_from=chn1, reuse_spl_n=1000)
|
68 | 68 | check_gdemo(chn1_contd2)
|
69 | 69 |
|
70 |
| - chn2 = sample(gdemo_default, alg2, 1000; save_state=true) |
| 70 | + chn2 = sample(gdemo_default, alg2, 2000; save_state=true) |
71 | 71 | check_gdemo(chn2)
|
72 | 72 |
|
73 |
| - chn2_contd = sample(gdemo_default, alg2, 1000; resume_from=chn2) |
| 73 | + chn2_contd = sample(gdemo_default, alg2, 2000; resume_from=chn2) |
74 | 74 | check_gdemo(chn2_contd)
|
75 | 75 |
|
76 |
| - chn3 = sample(gdemo_default, alg3, 5000; save_state=true) |
77 |
| - # HACK: Increase `atol` because apparently on MacOS 0.2, which is default, |
78 |
| - # can sometimes be too small. |
79 |
| - check_gdemo(chn3; atol=0.3) |
| 76 | + chn3 = sample(gdemo_default, alg3, 5_000; save_state=true) |
| 77 | + check_gdemo(chn3) |
80 | 78 |
|
81 |
| - chn3_contd = sample(gdemo_default, alg3, 1000; resume_from=chn3) |
82 |
| - check_gdemo(chn3_contd, atol=0.3) |
| 79 | + chn3_contd = sample(gdemo_default, alg3, 2_000; resume_from=chn3) |
| 80 | + check_gdemo(chn3_contd) |
83 | 81 | end
|
84 | 82 | @testset "Contexts" begin
|
85 | 83 | # Test LikelihoodContext
|
|
107 | 105 | @test isapprox(getlogp(varinfo2) / getlogp(varinfo1), 10)
|
108 | 106 | end
|
109 | 107 | @testset "Prior" begin
|
110 |
| - N = 5000 |
| 108 | + N = 10_000 |
111 | 109 |
|
112 | 110 | # Note that all chains contain 3 values per sample: 2 variables + log probability
|
113 | 111 | Random.seed!(100)
|
|
121 | 119 | chains = sample(gdemo_d(), Prior(), MCMCThreads(), N, 4)
|
122 | 120 | @test chains isa MCMCChains.Chains
|
123 | 121 | @test size(chains) == (N, 3, 4)
|
124 |
| - @test mean(chains, :s) ≈ 3 atol=0.2 |
| 122 | + @test mean(chains, :s) ≈ 3 atol=0.1 |
125 | 123 | @test mean(chains, :m) ≈ 0 atol=0.1
|
126 | 124 |
|
127 | 125 | Random.seed!(100)
|
|
0 commit comments