File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 8
8
return nothing
9
9
end
10
10
11
+ @model logp_check () = x ~ Normal ()
12
+
11
13
n_samples = 1000
12
- model = demo ()
14
+ model = demo ()
13
15
14
16
@testset for sampler in [
15
17
RandPermGibbs (Slice (1 )),
30
32
)
31
33
32
34
chain = sample (model, externalsampler (sampler), n_samples; progress= false )
35
+
36
+ chain_logp_check = sample (
37
+ logp_check (), externalsampler (sampler), 100 ; progress= false
38
+ )
39
+ @test isapprox (logpdf .(Normal (), chain_logp_check[:x ]), chain_logp_check[:logp ])
33
40
end
34
41
35
42
@testset " gibbs($sampler )" for sampler in [
46
53
n_samples;
47
54
progress= false ,
48
55
)
56
+
57
+ chain_logp_check = sample (
58
+ logp_check (), Turing. Gibbs (:x => externalsampler (sampler)), 100 ; progress= false
59
+ )
60
+ @test isapprox (logpdf .(Normal (), chain_logp_check[:x ]), chain_logp_check[:logp ])
49
61
end
50
62
end
You can’t perform that action at this time.
0 commit comments