Skip to content

Commit b1a7325

Browse files
fix test_calibration_log_gamma_end_to_end unit test failing too often than expected
1 parent 2a19d32 commit b1a7325

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/test_diagnostics/test_diagnostics_metrics.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ def run_sbc(N=N, S=S, D=D, bias=0):
116116
ranks = np.sum(posterior_draws < prior_draws, axis=0)
117117

118118
# this is the distribution of gamma under uniform ranks
119-
gamma_null = bf.diagnostics.metrics.gamma_null_distribution(D, S, num_null_draws=100)
120-
lower, upper = np.quantile(gamma_null, (0.05, 0.995))
119+
gamma_null = bf.diagnostics.metrics.gamma_null_distribution(D, S, num_null_draws=200)
120+
lower, upper = np.quantile(gamma_null, (0.025, 0.975))
121121

122122
# this is the empirical gamma
123123
observed_gamma = bf.diagnostics.metrics.gamma_discrepancy(ranks, num_post_draws=S)
@@ -127,7 +127,7 @@ def run_sbc(N=N, S=S, D=D, bias=0):
127127
return in_interval
128128

129129
sbc_calibration = [run_sbc(N=N, S=S, D=D) for _ in range(100)]
130-
lower_expected, upper_expected = binom.ppf((0.0005, 0.9995), 100, 0.95)
130+
lower_expected, upper_expected = binom.ppf((0.0001, 0.9999), 100, 0.95)
131131

132132
# this test should fail with a probability of 0.1%
133133
assert lower_expected <= np.sum(sbc_calibration) <= upper_expected

0 commit comments

Comments
 (0)