@@ -388,63 +388,6 @@ def test_multiple_observed_rv(self, log_likelihood):
388
388
fails = check_multiple_attrs (test_dict , inference_data )
389
389
assert not fails
390
390
391
- @pytest .mark .xfail (reason = "MultiObservedRV is no longer used in v4" )
392
- def test_multiple_observed_rv_without_observations (self ):
393
- with pm .Model ():
394
- mu = pm .Normal ("mu" )
395
- x = pm .DensityDist ( # pylint: disable=unused-variable
396
- "x" , mu , logp = lambda value , mu : pm .Normal .logp (value , mu , 1 ), observed = 0.1
397
- )
398
- inference_data = pm .sample (100 , chains = 2 , return_inferencedata = True )
399
- test_dict = {
400
- "posterior" : ["mu" ],
401
- "sample_stats" : ["lp" ],
402
- "log_likelihood" : ["x" ],
403
- "observed_data" : ["value" , "~x" ],
404
- }
405
- fails = check_multiple_attrs (test_dict , inference_data )
406
- assert not fails
407
- assert inference_data .observed_data .value .dtype .kind == "f"
408
-
409
- @pytest .mark .xfail (reason = "MultiObservedRV is no longer used in v4" )
410
- @pytest .mark .parametrize ("multiobs" , (True , False ))
411
- def test_multiobservedrv_to_observed_data (self , multiobs ):
412
- # fake regression data, with weights (W)
413
- np .random .seed (2019 )
414
- N = 100
415
- X = np .random .uniform (size = N )
416
- W = 1 + np .random .poisson (size = N )
417
- a , b = 5 , 17
418
- Y = a + np .random .normal (b * X )
419
-
420
- with pm .Model ():
421
- a = pm .Normal ("a" , 0 , 10 )
422
- b = pm .Normal ("b" , 0 , 10 )
423
- mu = a + b * X
424
- sigma = pm .HalfNormal ("sigma" , 1 )
425
- w = W
426
-
427
- def weighted_normal (value , mu , sigma , w ):
428
- return w * pm .Normal .logp (value , mu , sigma )
429
-
430
- y_logp = pm .DensityDist ( # pylint: disable=unused-variable
431
- "y_logp" , mu , sigma , w , logp = weighted_normal , observed = Y , size = N
432
- )
433
- idata = pm .sample (
434
- 20 , tune = 20 , return_inferencedata = True , idata_kwargs = {"density_dist_obs" : multiobs }
435
- )
436
- multiobs_str = "" if multiobs else "~"
437
- test_dict = {
438
- "posterior" : ["a" , "b" , "sigma" ],
439
- "sample_stats" : ["lp" ],
440
- "log_likelihood" : ["y_logp" ],
441
- f"{ multiobs_str } observed_data" : ["y" , "w" ],
442
- }
443
- fails = check_multiple_attrs (test_dict , idata )
444
- assert not fails
445
- if multiobs :
446
- assert idata .observed_data .y .dtype .kind == "f"
447
-
448
391
def test_single_observation (self ):
449
392
with pm .Model ():
450
393
p = pm .Uniform ("p" , 0 , 1 )
0 commit comments