Prioritize recall in failure-driven sampling
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:10:19 +02:00
parent be5cbb855a
commit b8e40ba7a8
2 changed files with 44 additions and 2 deletions
+15 -1
View File
@@ -94,6 +94,15 @@ def build_sampling(
and background["pure_empty_false_positives"]
> gates["max_pure_empty_false_positives"]
)
recall_dominant_regions = {
region
for region in weak_recall_regions & weak_precision_regions
if not background_failed
and (
regions[region]["recall"] / gates["min_region_recall"]
< regions[region]["precision"] / gates["min_region_precision"]
)
}
weak_recall_contexts: set[tuple[str, str]] = set()
weak_precision_contexts: set[tuple[str, str]] = set()
for sample_slug, metrics in evaluation.get("samples", {}).items():
@@ -140,7 +149,11 @@ def build_sampling(
# Precision-only correction still needs positive examples to avoid
# shifting the classifier toward background and sacrificing recall.
repeat = precision_positive_repeat
if tile["label_count"] == 0 and (background_failed or region in weak_precision_regions):
if (
tile["label_count"] == 0
and (background_failed or region in weak_precision_regions)
and region not in recall_dominant_regions
):
repeat = (
context_negative_repeat
if context_key in targeted_negative_contexts
@@ -197,6 +210,7 @@ def build_sampling(
"failure_evidence_source": "test" if assessment.get("test") else "calibration",
"weak_recall_regions": sorted(weak_recall_regions),
"weak_precision_regions": sorted(weak_precision_regions),
"recall_dominant_regions": sorted(recall_dominant_regions),
"weak_recall_contexts": [f"{region}:{context}" for region, context in sorted(weak_recall_contexts)],
"weak_precision_contexts": [f"{region}:{context}" for region, context in sorted(weak_precision_contexts)],
"targeted_negative_contexts": [