|
34 | 34 |
|
35 | 35 | @testset "init" begin
|
36 | 36 | @testset "$(model.f)" for model in DynamicPPL.TestUtils.DEMO_MODELS
|
37 |
| - @testset "$(model.f)" for model in DynamicPPL.TestUtils.DEMO_MODELS |
38 |
| - N = 1000 |
39 |
| - chain_init = sample(model, SampleFromUniform(), N; progress=false) |
40 |
| - |
41 |
| - for vn in keys(first(chain_init)) |
42 |
| - if AbstractPPL.subsumes(@varname(s), vn) |
43 |
| - # `s ~ InverseGamma(2, 3)` and its unconstrained value will be sampled from Unif[-2,2]. |
44 |
| - dist = InverseGamma(2, 3) |
45 |
| - b = DynamicPPL.link_transform(dist) |
46 |
| - @test mean(mean(b(vi[vn])) for vi in chain_init) ≈ 0 atol = 0.11 |
47 |
| - elseif AbstractPPL.subsumes(@varname(m), vn) |
48 |
| - # `m ~ Normal(0, sqrt(s))` and its constrained value is the same. |
49 |
| - @test mean(mean(vi[vn]) for vi in chain_init) ≈ 0 atol = 0.11 |
50 |
| - else |
51 |
| - error("Unknown variable name: $vn") |
52 |
| - end |
| 37 | + N = 1000 |
| 38 | + chain_init = sample(model, SampleFromUniform(), N; progress=false) |
| 39 | + |
| 40 | + for vn in keys(first(chain_init)) |
| 41 | + if AbstractPPL.subsumes(@varname(s), vn) |
| 42 | + # `s ~ InverseGamma(2, 3)` and its unconstrained value will be sampled from Unif[-2,2]. |
| 43 | + dist = InverseGamma(2, 3) |
| 44 | + b = DynamicPPL.link_transform(dist) |
| 45 | + @test mean(mean(b(vi[vn])) for vi in chain_init) ≈ 0 atol = 0.11 |
| 46 | + elseif AbstractPPL.subsumes(@varname(m), vn) |
| 47 | + # `m ~ Normal(0, sqrt(s))` and its constrained value is the same. |
| 48 | + @test mean(mean(vi[vn]) for vi in chain_init) ≈ 0 atol = 0.11 |
| 49 | + else |
| 50 | + error("Unknown variable name: $vn") |
53 | 51 | end
|
54 | 52 | end
|
55 | 53 | end
|
|
0 commit comments