Drive corpus sampling from calibration failures
This commit is contained in:
@@ -34,7 +34,10 @@ def build_sampling(
|
||||
|
||||
samples = {item["sample_slug"]: item for item in manifest["samples"]}
|
||||
gates = assessment["gates"]
|
||||
regions = assessment["test"]["regions"]
|
||||
evaluation = assessment.get("test") or assessment.get("calibration")
|
||||
if not evaluation or "regions" not in evaluation:
|
||||
raise ValueError("Assessment has no regional calibration or test evidence")
|
||||
regions = evaluation["regions"]
|
||||
weak_recall_regions = {
|
||||
region
|
||||
for region, metrics in regions.items()
|
||||
@@ -46,8 +49,10 @@ def build_sampling(
|
||||
for region, metrics in regions.items()
|
||||
if metrics["precision"] < gates["min_region_precision"]
|
||||
}
|
||||
background_failed = (
|
||||
assessment["background"]["pure_empty_false_positives"]
|
||||
background = assessment.get("background")
|
||||
background_failed = bool(
|
||||
background
|
||||
and background["pure_empty_false_positives"]
|
||||
> gates["max_pure_empty_false_positives"]
|
||||
)
|
||||
|
||||
@@ -77,6 +82,7 @@ def build_sampling(
|
||||
"schema_version": 1,
|
||||
"status": "ok",
|
||||
"strategy": "failed-region-positive-and-hard-negative-repeat",
|
||||
"failure_evidence_source": "test" if assessment.get("test") else "calibration",
|
||||
"weak_recall_regions": sorted(weak_recall_regions),
|
||||
"weak_precision_regions": sorted(weak_precision_regions),
|
||||
"background_gate_failed": background_failed,
|
||||
|
||||
Reference in New Issue
Block a user