diff --git a/pymc3/tests/test_distributions_random.py b/pymc3/tests/test_distributions_random.py index 9171c731196..01bbe19cd95 100644 --- a/pymc3/tests/test_distributions_random.py +++ b/pymc3/tests/test_distributions_random.py @@ -1351,7 +1351,7 @@ class TestMatrixNormal(BaseTestDistribution): def test_matrix_normal(self): delta = 0.05 # limit for KS p-value - n_fails = 100 # Allows the KS fails a certain number of times + n_fails = 10 # Allows the KS fails a certain number of times size = (100,) def ref_rand(size, mu, rowcov, colcov): @@ -1374,12 +1374,14 @@ def ref_rand(size, mu, rowcov, colcov): matrixnormal_smp = check["mvnormal"][f - 1, :, :] curr_ref_smp = ref_smp[f - 1, :, :] - p = min( - st.ks_2samp( - np.atleast_1d(matrixnormal_smp[..., idx]).flatten(), - np.atleast_1d(curr_ref_smp[..., idx]).flatten(), - )[1] - for idx in range(matrixnormal_smp.shape[-1]) + p = np.mean( + [ + st.ks_2samp( + np.atleast_1d(matrixnormal_smp[..., idx]).flatten(), + np.atleast_1d(curr_ref_smp[..., idx]).flatten(), + )[1] + for idx in range(matrixnormal_smp.shape[-1]) + ] ) f -= 1