Prioritize recall in failure-driven sampling
This commit is contained in:
@@ -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": [
|
||||
|
||||
Reference in New Issue
Block a user