@@ -44,7 +44,7 @@ def test_sample(self):
44
44
pm .Normal ("obs" , b * x_shared , np .sqrt (1e-2 ), observed = y )
45
45
46
46
prior_trace0 = pm .sample_prior_predictive (1000 )
47
- trace = pm .sample (1000 , init = None , tune = 1000 , chains = 1 )
47
+ trace = pm .sample (1000 , init = None , tune = 1000 , chains = 1 , return_inferencedata = False )
48
48
pp_trace0 = pm .sample_posterior_predictive (trace , 1000 )
49
49
pp_trace01 = pm .fast_sample_posterior_predictive (trace , 1000 )
50
50
@@ -75,7 +75,7 @@ def test_sample_posterior_predictive_after_set_data(self):
75
75
y = pm .Data ("y" , [1.0 , 2.0 , 3.0 ])
76
76
beta = pm .Normal ("beta" , 0 , 10.0 )
77
77
pm .Normal ("obs" , beta * x , np .sqrt (1e-2 ), observed = y )
78
- trace = pm .sample (1000 , tune = 1000 , chains = 1 )
78
+ trace = pm .sample (1000 , tune = 1000 , chains = 1 , return_inferencedata = False )
79
79
# Predict on new data.
80
80
with model :
81
81
x_test = [5.0 , 6.0 , 9.0 ]
@@ -94,13 +94,13 @@ def test_sample_after_set_data(self):
94
94
y = pm .Data ("y" , [1.0 , 2.0 , 3.0 ])
95
95
beta = pm .Normal ("beta" , 0 , 10.0 )
96
96
pm .Normal ("obs" , beta * x , np .sqrt (1e-2 ), observed = y )
97
- pm .sample (1000 , init = None , tune = 1000 , chains = 1 )
97
+ pm .sample (1000 , init = None , tune = 1000 , chains = 1 , return_inferencedata = False )
98
98
# Predict on new data.
99
99
new_x = [5.0 , 6.0 , 9.0 ]
100
100
new_y = [5.0 , 6.0 , 9.0 ]
101
101
with model :
102
102
pm .set_data (new_data = {"x" : new_x , "y" : new_y })
103
- new_trace = pm .sample (1000 , init = None , tune = 1000 , chains = 1 )
103
+ new_trace = pm .sample (1000 , init = None , tune = 1000 , chains = 1 , return_inferencedata = False )
104
104
pp_trace = pm .sample_posterior_predictive (new_trace , 1000 )
105
105
pp_tracef = pm .fast_sample_posterior_predictive (new_trace , 1000 )
106
106
@@ -121,7 +121,7 @@ def test_shared_data_as_index(self):
121
121
pm .Normal ("obs" , alpha [index ], np .sqrt (1e-2 ), observed = y )
122
122
123
123
prior_trace = pm .sample_prior_predictive (1000 , var_names = ["alpha" ])
124
- trace = pm .sample (1000 , init = None , tune = 1000 , chains = 1 )
124
+ trace = pm .sample (1000 , init = None , tune = 1000 , chains = 1 , return_inferencedata = False )
125
125
126
126
# Predict on new data
127
127
new_index = np .array ([0 , 1 , 2 ])
@@ -146,14 +146,14 @@ def test_shared_data_as_rv_input(self):
146
146
with pm .Model () as m :
147
147
x = pm .Data ("x" , [1.0 , 2.0 , 3.0 ])
148
148
_ = pm .Normal ("y" , mu = x , shape = 3 )
149
- trace = pm .sample (chains = 1 )
149
+ trace = pm .sample (chains = 1 , return_inferencedata = False )
150
150
151
151
np .testing .assert_allclose (np .array ([1.0 , 2.0 , 3.0 ]), x .get_value (), atol = 1e-1 )
152
152
np .testing .assert_allclose (np .array ([1.0 , 2.0 , 3.0 ]), trace ["y" ].mean (0 ), atol = 1e-1 )
153
153
154
154
with m :
155
155
pm .set_data ({"x" : np .array ([2.0 , 4.0 , 6.0 ])})
156
- trace = pm .sample (chains = 1 )
156
+ trace = pm .sample (chains = 1 , return_inferencedata = False )
157
157
158
158
np .testing .assert_allclose (np .array ([2.0 , 4.0 , 6.0 ]), x .get_value (), atol = 1e-1 )
159
159
np .testing .assert_allclose (np .array ([2.0 , 4.0 , 6.0 ]), trace ["y" ].mean (0 ), atol = 1e-1 )
@@ -189,7 +189,7 @@ def test_set_data_to_non_data_container_variables(self):
189
189
y = np .array ([1.0 , 2.0 , 3.0 ])
190
190
beta = pm .Normal ("beta" , 0 , 10.0 )
191
191
pm .Normal ("obs" , beta * x , np .sqrt (1e-2 ), observed = y )
192
- pm .sample (1000 , init = None , tune = 1000 , chains = 1 )
192
+ pm .sample (1000 , init = None , tune = 1000 , chains = 1 , return_inferencedata = False )
193
193
with pytest .raises (TypeError ) as error :
194
194
pm .set_data ({"beta" : [1.1 , 2.2 , 3.3 ]}, model = model )
195
195
error .match ("defined as `pymc3.Data` inside the model" )
@@ -201,7 +201,7 @@ def test_model_to_graphviz_for_model_with_data_container(self):
201
201
beta = pm .Normal ("beta" , 0 , 10.0 )
202
202
obs_sigma = floatX (np .sqrt (1e-2 ))
203
203
pm .Normal ("obs" , beta * x , obs_sigma , observed = y )
204
- pm .sample (1000 , init = None , tune = 1000 , chains = 1 )
204
+ pm .sample (1000 , init = None , tune = 1000 , chains = 1 , return_inferencedata = False )
205
205
206
206
for formatting in {"latex" , "latex_with_params" }:
207
207
with pytest .raises (ValueError , match = "Unsupported formatting" ):
0 commit comments