17
17
const gdemo_default = gdemo_d ()
18
18
19
19
@testset " compiler.jl" begin
20
+ @info " compiler.jl"
21
+
20
22
@testset " assume" begin
23
+ @info " assume"
24
+
21
25
@model function test_assume ()
22
26
x ~ Bernoulli (1 )
23
27
y ~ Bernoulli (x / 2 )
@@ -37,7 +41,10 @@ const gdemo_default = gdemo_d()
37
41
@test all (isone, res1[:x ])
38
42
@test all (isone, res2[:x ])
39
43
end
44
+
40
45
@testset " beta binomial" begin
46
+ @info " beta binomial"
47
+
41
48
prior = Beta (2 , 2 )
42
49
obs = [0 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ]
43
50
exact = Beta (prior. α + sum (obs), prior. β + length (obs) - sum (obs))
@@ -64,7 +71,9 @@ const gdemo_default = gdemo_d()
64
71
check_numerical (chn_p, [:x ], [meanp]; atol= 0.1 )
65
72
check_numerical (chn_g, [:x ], [meanp]; atol= 0.1 )
66
73
end
74
+
67
75
@testset " model with global variables" begin
76
+ @info " model with global variables"
68
77
xs = [1.5 2.0 ]
69
78
# xx = 1
70
79
@@ -84,7 +93,9 @@ const gdemo_default = gdemo_d()
84
93
gibbs = Gibbs (:s => PG (10 ), :m => HMC (0.4 , 8 ))
85
94
chain = sample (fggibbstest (xs), gibbs, 2 )
86
95
end
96
+
87
97
@testset " new grammar" begin
98
+ @info " new grammar"
88
99
x = Float64[1 2 ]
89
100
90
101
@model function gauss (x)
@@ -121,7 +132,9 @@ const gdemo_default = gdemo_d()
121
132
gauss2 (DynamicPPL. TypeWrap {Vector{Float64}} (); x= x), SMC (), 10
122
133
)
123
134
end
135
+
124
136
@testset " new interface" begin
137
+ @info " new interface"
125
138
obs = [0 , 1 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ]
126
139
127
140
@model function newinterface (obs)
@@ -138,7 +151,9 @@ const gdemo_default = gdemo_d()
138
151
100 ,
139
152
)
140
153
end
154
+
141
155
@testset " no return" begin
156
+ @info " no return"
142
157
@model function noreturn (x)
143
158
s ~ InverseGamma (2 , 3 )
144
159
m ~ Normal (0 , sqrt (s))
@@ -150,7 +165,9 @@ const gdemo_default = gdemo_d()
150
165
chain = sample (noreturn ([1.5 2.0 ]), HMC (0.15 , 6 ), 1000 )
151
166
check_numerical (chain, [:s , :m ], [49 / 24 , 7 / 6 ])
152
167
end
168
+
153
169
@testset " observe with literals" begin
170
+ @info " observe with literals"
154
171
@model function test ()
155
172
z ~ Normal (0 , 1 )
156
173
x ~ Bernoulli (1 )
@@ -177,11 +194,13 @@ const gdemo_default = gdemo_d()
177
194
end
178
195
179
196
@testset " sample" begin
197
+ @info " sample"
180
198
alg = Gibbs (:m => HMC (0.2 , 3 ), :s => PG (10 ))
181
199
chn = sample (gdemo_default, alg, 1000 )
182
200
end
183
201
184
202
@testset " vectorization @." begin
203
+ @info " vectorization @."
185
204
@model function vdemo1 (x)
186
205
s ~ InverseGamma (2 , 3 )
187
206
m ~ Normal (0 , sqrt (s))
@@ -257,7 +276,9 @@ const gdemo_default = gdemo_d()
257
276
258
277
sample (vdemo7 (), alg, 1000 )
259
278
end
279
+
260
280
@testset " vectorization .~" begin
281
+ @info " vectorization .~"
261
282
@model function vdemo1 (x)
262
283
s ~ InverseGamma (2 , 3 )
263
284
m ~ Normal (0 , sqrt (s))
@@ -323,7 +344,9 @@ const gdemo_default = gdemo_d()
323
344
324
345
sample (vdemo7 (), alg, 1000 )
325
346
end
347
+
326
348
@testset " Type parameters" begin
349
+ @info " Type parameters"
327
350
N = 10
328
351
alg = HMC (0.01 , 5 ; adtype= AutoForwardDiff (; chunksize= N))
329
352
x = randn (1000 )
0 commit comments