Skip to content

Commit 0f729a4

Browse files
Log gamma test fix (#535)
* fix test_calibration_log_gamma_end_to_end unit test failing too often than expected * set alpha to 0.1% in binom.ppf * fix typo in comment
1 parent 2038d66 commit 0f729a4

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)
@@ -132,7 +132,7 @@ def run_sbc(N=N, S=S, D=D, bias=0):
132132
# this test should fail with a probability of 0.1%
133133
assert lower_expected <= np.sum(sbc_calibration) <= upper_expected
134134

135-
# sbc should almost always fial for slightly biased posterior draws
135+
# sbc should almost always fail for slightly biased posterior draws
136136
sbc_calibration = [run_sbc(N=N, S=S, D=D, bias=1) for _ in range(100)]
137137
assert not lower_expected <= np.sum(sbc_calibration) <= upper_expected
138138

0 commit comments

Comments
 (0)