Keep rejected training regressions from propagating
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user