Skip to content

Commit f307251

Browse files
add test_log_gamma unit test
1 parent 3013206 commit f307251

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/test_diagnostics/test_diagnostics_metrics.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,15 @@ def test_expected_calibration_error(pred_models, true_models, model_names):
8585
out = bf.diagnostics.metrics.expected_calibration_error(pred_models, true_models.transpose)
8686

8787

88-
def test_log_gamma():
88+
def test_log_gamma(random_estimates, random_targets):
89+
out = bf.diagnostics.metrics.log_gamma(random_estimates, random_targets)
90+
assert list(out.keys()) == ["values", "metric_name", "variable_names"]
91+
assert out["values"].shape == (num_variables(random_estimates),)
92+
assert out["metric_name"] == "Log Gamma"
93+
assert out["variable_names"] == ["beta_0", "beta_1", "sigma"]
94+
95+
96+
def test_log_gamma_end_to_end():
8997
# This is a function test for simulation-based calibration.
9098
# First, we sample from a known generative process and then run SBC.
9199
# If the log gamma statistic is correctly implemented, a 95% interval should exclude

0 commit comments

Comments
 (0)