Skip to content

Commit ed3f094

Browse files
authored
Attempt to tighten assertion accurary bounds by increasing MCMC samples (#1905)
* Update Inference.jl * Apply suggestions from code review * Apply suggestions from code review * Apply suggestions from code review * Apply suggestions from code review * Apply suggestions from code review * Update test/inference/Inference.jl
1 parent 7c38ee9 commit ed3f094

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

test/inference/Inference.jl

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
chn1 = sample(gdemo_default, alg1, 5000; save_state=true)
5959
check_gdemo(chn1)
6060

61-
chn1_resumed = Turing.Inference.resume(chn1, 1000)
61+
chn1_resumed = Turing.Inference.resume(chn1, 2000)
6262
check_gdemo(chn1_resumed)
6363

6464
chn1_contd = sample(gdemo_default, alg1, 5000; resume_from=chn1)
@@ -67,19 +67,17 @@
6767
chn1_contd2 = sample(gdemo_default, alg1, 5000; resume_from=chn1, reuse_spl_n=1000)
6868
check_gdemo(chn1_contd2)
6969

70-
chn2 = sample(gdemo_default, alg2, 1000; save_state=true)
70+
chn2 = sample(gdemo_default, alg2, 2000; save_state=true)
7171
check_gdemo(chn2)
7272

73-
chn2_contd = sample(gdemo_default, alg2, 1000; resume_from=chn2)
73+
chn2_contd = sample(gdemo_default, alg2, 2000; resume_from=chn2)
7474
check_gdemo(chn2_contd)
7575

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)
8078

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)
8381
end
8482
@testset "Contexts" begin
8583
# Test LikelihoodContext
@@ -107,7 +105,7 @@
107105
@test isapprox(getlogp(varinfo2) / getlogp(varinfo1), 10)
108106
end
109107
@testset "Prior" begin
110-
N = 5000
108+
N = 10_000
111109

112110
# Note that all chains contain 3 values per sample: 2 variables + log probability
113111
Random.seed!(100)
@@ -121,7 +119,7 @@
121119
chains = sample(gdemo_d(), Prior(), MCMCThreads(), N, 4)
122120
@test chains isa MCMCChains.Chains
123121
@test size(chains) == (N, 3, 4)
124-
@test mean(chains, :s) 3 atol=0.2
122+
@test mean(chains, :s) 3 atol=0.1
125123
@test mean(chains, :m) 0 atol=0.1
126124

127125
Random.seed!(100)

0 commit comments

Comments
 (0)