Keep rejected training regressions from propagating
GeoIntel release gates / Compile, test, contracts and builds (push) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (push) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (push) Canceled after 0s

This commit is contained in:
Jens
2026-07-29 23:33:53 +02:00
parent b8e40ba7a8
commit a5b321fdb6
2 changed files with 60 additions and 2 deletions
@@ -266,3 +266,34 @@ def test_threshold_selection_uses_worst_region_then_aggregate() -> None:
]
}
assert MODULE.select_calibration_threshold(report)["threshold"] == 0.2
def test_rejected_candidate_score_prioritizes_weakest_release_gate() -> None:
gates = {
"min_aggregate_f1": 0.55,
"min_region_f1": 0.45,
"min_region_precision": 0.5,
"min_region_recall": 0.4,
}
incumbent = {
"gates": gates,
"calibration": {
"aggregate": {"f1": 0.58},
"regions": {
"flanders": {"f1": 0.34, "precision": 0.38, "recall": 0.31},
"wallonia": {"f1": 0.60, "precision": 0.50, "recall": 0.75},
},
},
}
regressed = {
"gates": gates,
"calibration": {
"aggregate": {"f1": 0.60},
"regions": {
"flanders": {"f1": 0.31, "precision": 0.45, "recall": 0.24},
"wallonia": {"f1": 0.62, "precision": 0.52, "recall": 0.77},
},
},
}
assert MODULE.rejected_candidate_score(incumbent) > MODULE.rejected_candidate_score(regressed)