@@ -85,15 +85,15 @@ def test_expected_calibration_error(pred_models, true_models, model_names):
85
85
out = bf .diagnostics .metrics .expected_calibration_error (pred_models , true_models .transpose )
86
86
87
87
88
- def test_log_gamma (random_estimates , random_targets ):
89
- out = bf .diagnostics .metrics .log_gamma (random_estimates , random_targets )
88
+ def test_calibration_log_gamma (random_estimates , random_targets ):
89
+ out = bf .diagnostics .metrics .calibration_log_gamma (random_estimates , random_targets )
90
90
assert list (out .keys ()) == ["values" , "metric_name" , "variable_names" ]
91
91
assert out ["values" ].shape == (num_variables (random_estimates ),)
92
92
assert out ["metric_name" ] == "Log Gamma"
93
93
assert out ["variable_names" ] == ["beta_0" , "beta_1" , "sigma" ]
94
94
95
95
96
- def test_log_gamma_end_to_end ():
96
+ def test_calibration_log_gamma_end_to_end ():
97
97
# This is a function test for simulation-based calibration.
98
98
# First, we sample from a known generative process and then run SBC.
99
99
# If the log gamma statistic is correctly implemented, a 95% interval should exclude
@@ -116,11 +116,11 @@ def run_sbc(N=N, S=S, D=D, bias=0):
116
116
ranks = np .sum (posterior_draws < prior_draws , axis = 0 )
117
117
118
118
# this is the distribution of gamma under uniform ranks
119
- gamma_null = bf .diagnostics .metrics .sbc . gamma_null_distribution (D , S , num_null_draws = 100 )
119
+ gamma_null = bf .diagnostics .metrics .gamma_null_distribution (D , S , num_null_draws = 100 )
120
120
lower , upper = np .quantile (gamma_null , (0.05 , 0.995 ))
121
121
122
122
# this is the empirical gamma
123
- observed_gamma = bf .diagnostics .metrics .sbc . gamma_discrepancy (ranks , num_post_draws = S )
123
+ observed_gamma = bf .diagnostics .metrics .gamma_discrepancy (ranks , num_post_draws = S )
124
124
125
125
in_interval = lower <= observed_gamma < upper
126
126
0 commit comments