@@ -472,36 +472,38 @@ def test_normal_scalar(self):
472
472
trace = pm .sample (
473
473
draws = ndraws ,
474
474
chains = nchains ,
475
+ return_inferencedata = False ,
475
476
)
476
477
477
478
with model :
478
479
# test list input
479
- ppc0 = pm .sample_posterior_predictive ([model .initial_point ], samples = 10 )
480
+ ppc0 = pm .sample_posterior_predictive (
481
+ [model .initial_point ], samples = 10 , return_inferencedata = False
482
+ )
480
483
# # deprecated argument is not introduced to fast version [2019/08/20:rpg]
481
- ppc = pm .sample_posterior_predictive (trace , var_names = ["a" ])
484
+ ppc = pm .sample_posterior_predictive (trace , var_names = ["a" ], return_inferencedata = False )
482
485
# test empty ppc
483
- ppc = pm .sample_posterior_predictive (trace , var_names = [])
486
+ ppc = pm .sample_posterior_predictive (trace , var_names = [], return_inferencedata = False )
484
487
assert len (ppc ) == 0
485
488
486
489
# test keep_size parameter
487
- ppc = pm .sample_posterior_predictive (trace , keep_size = True )
488
- assert ppc . posterior_predictive ["a" ].shape == (1 , nchains , ndraws )
490
+ ppc = pm .sample_posterior_predictive (trace , keep_size = True , return_inferencedata = False )
491
+ assert ppc ["a" ].shape == (nchains , ndraws )
489
492
490
493
# test default case
491
- ppc = pm .sample_posterior_predictive (trace , var_names = ["a" ])
492
- assert "a" in ppc . posterior_predictive . data_vars
493
- assert ppc . posterior_predictive ["a" ].shape == (1 , nchains * ndraws )
494
+ ppc = pm .sample_posterior_predictive (trace , var_names = ["a" ], return_inferencedata = False )
495
+ assert "a" in ppc
496
+ assert ppc ["a" ].shape == (nchains * ndraws , )
494
497
# mu's standard deviation may have changed thanks to a's observed
495
- _ , pval = stats .kstest (
496
- ppc .posterior_predictive ["a" ] - trace .posterior ["mu" ],
497
- stats .norm (loc = 0 , scale = 1 ).cdf ,
498
- )
498
+ _ , pval = stats .kstest (ppc ["a" ] - trace ["mu" ], stats .norm (loc = 0 , scale = 1 ).cdf )
499
499
assert pval > 0.001
500
500
501
501
# size argument not introduced to fast version [2019/08/20:rpg]
502
502
with model :
503
- ppc = pm .sample_posterior_predictive (trace , size = 5 , var_names = ["a" ])
504
- assert ppc .posterior_predictive ["a" ].shape == (1 , nchains * ndraws , 5 )
503
+ ppc = pm .sample_posterior_predictive (
504
+ trace , size = 5 , var_names = ["a" ], return_inferencedata = False
505
+ )
506
+ assert ppc ["a" ].shape == (nchains * ndraws , 5 )
505
507
506
508
def test_normal_vector (self , caplog ):
507
509
with pm .Model () as model :
0 commit comments