|
23 | 23 | from pymc3.distributions import HalfCauchy, Normal, transforms
|
24 | 24 | from pymc3 import Potential, Deterministic
|
25 | 25 | from pymc3.model import ValueGradFunction
|
| 26 | +from .helpers import select_by_precision |
26 | 27 |
|
27 | 28 |
|
28 | 29 | class NewModel(pm.Model):
|
@@ -192,17 +193,33 @@ def test_matrix_multiplication():
|
192 | 193 | tune=0,
|
193 | 194 | compute_convergence_checks=False,
|
194 | 195 | progressbar=False)
|
| 196 | + decimal = select_by_precision(7, 5) |
195 | 197 | for point in posterior.points():
|
196 |
| - npt.assert_almost_equal(point['matrix'] @ point['transformed'], |
197 |
| - point['rv_rv']) |
198 |
| - npt.assert_almost_equal(np.ones((2, 2)) @ point['transformed'], |
199 |
| - point['np_rv']) |
200 |
| - npt.assert_almost_equal(point['matrix'] @ np.ones(2), |
201 |
| - point['rv_np']) |
202 |
| - npt.assert_almost_equal(point['matrix'] @ point['rv_rv'], |
203 |
| - point['rv_det']) |
204 |
| - npt.assert_almost_equal(point['rv_rv'] @ point['transformed'], |
205 |
| - point['det_rv']) |
| 198 | + npt.assert_almost_equal( |
| 199 | + point['matrix'] @ point['transformed'], |
| 200 | + point['rv_rv'], |
| 201 | + decimal=decimal, |
| 202 | + ) |
| 203 | + npt.assert_almost_equal( |
| 204 | + np.ones((2, 2)) @ point['transformed'], |
| 205 | + point['np_rv'], |
| 206 | + decimal=decimal, |
| 207 | + ) |
| 208 | + npt.assert_almost_equal( |
| 209 | + point['matrix'] @ np.ones(2), |
| 210 | + point['rv_np'], |
| 211 | + decimal=decimal, |
| 212 | + ) |
| 213 | + npt.assert_almost_equal( |
| 214 | + point['matrix'] @ point['rv_rv'], |
| 215 | + point['rv_det'], |
| 216 | + decimal=decimal, |
| 217 | + ) |
| 218 | + npt.assert_almost_equal( |
| 219 | + point['rv_rv'] @ point['transformed'], |
| 220 | + point['det_rv'], |
| 221 | + decimal=decimal, |
| 222 | + ) |
206 | 223 |
|
207 | 224 |
|
208 | 225 | def test_duplicate_vars():
|
|
0 commit comments