@@ -313,6 +313,19 @@ def test_exceptions(self):
313
313
with pytest .raises (NotImplementedError ):
314
314
xvars = [t ["mu" ] for t in trace ]
315
315
316
+ def test_deterministic_of_unobserved (self ):
317
+ with pm .Model () as model :
318
+ x = pm .HalfNormal ("x" , 1 )
319
+ y = pm .Deterministic ("y" , x + 100 )
320
+ idata = pm .sample (
321
+ chains = 1 ,
322
+ tune = 10 ,
323
+ draws = 50 ,
324
+ compute_convergence_checks = False ,
325
+ )
326
+
327
+ np .testing .assert_allclose (idata .posterior ["y" ], idata .posterior ["x" ] + 100 )
328
+
316
329
317
330
def test_sample_find_MAP_does_not_modify_start ():
318
331
# see https://github.com/pymc-devs/pymc/pull/4458
@@ -1220,15 +1233,6 @@ def test_sample_from_xarray_posterior(self, point_list_arg_bug_fixture):
1220
1233
pp = pm .sample_posterior_predictive (idat .posterior , var_names = ["d" ])
1221
1234
1222
1235
1223
- def test_sample_deterministic ():
1224
- with pm .Model () as model :
1225
- x = pm .HalfNormal ("x" , 1 )
1226
- y = pm .Deterministic ("y" , x + 100 )
1227
- idata = pm .sample (chains = 1 , draws = 50 , compute_convergence_checks = False )
1228
-
1229
- np .testing .assert_allclose (idata .posterior ["y" ], idata .posterior ["x" ] + 100 )
1230
-
1231
-
1232
1236
class TestDraw (SeededTest ):
1233
1237
def test_univariate (self ):
1234
1238
with pm .Model ():
0 commit comments