FAILURE MAP
← Case archive

FA-99981 / Evaluation metric aggregation / Open access

Grouped recall pools groups before averaging · case 01

Grouped recall pools groups before averaging.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Rows from larger groups dominate an evaluation intended to give groups equal weight.

THE FAILURE

Rows from larger groups dominate an evaluation intended to give groups equal weight.

Unsuccessful approach: Averaging per-row correctness counts groups only when they have equal sizes.

Case contract

Rows are [group,actual,predicted]. Return mean recall across groups that contain actual positives; groups with no positives are omitted; none yields 0.

Why this case matters

A small explicit evaluation contract makes aggregation behavior reproducible across labeled examples.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows):
    tp=sum(g==g2 and a==1 and p==1 for g,a,p in rows for g2,_,_ in rows); positives=sum(a==1 for _,a,_ in rows); return tp/positives if positives else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal group sizes',solve([['a',1,1]]*N+[['b',1,0]]),.5)
check('distinct group rates',solve([['a',1,1],['a',1,0],['b',1,1]]),.75)
check('perfect groups',solve([['a',1,1],['b',1,1]]),1)
check('empty',solve([]),0)
check('no positive group',solve([['a',0,1]]),0)
check('negative group omitted',solve([['a',1,1],['b',0,1]]),1)
check('grouped miss',solve([['a',1,0]]*N),0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
unequal group sizes0.50.5Passed
distinct group rates1.00.75Failed
perfect groups1.01Passed
empty00Passed
no positive group00Passed
negative group omitted1.01Passed
grouped miss0.00Passed

SHA-256 / 60e9f4c81e6496f10aba2009769a273f616d9eea6e7fa2347758f6f9aecfb717

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(rows):
    groups=sorted({g for g,a,p in rows if a==1}); vals=[]
    for g in groups:
        total=sum(a==1 for g2,a,p in rows if g2==g); hit=sum(a==1 and p==1 for g2,a,p in rows if g2==g); vals.append(hit/total)
    return sum(vals)/max(1,len(rows))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('unequal group sizes',solve([['a',1,1]]*N+[['b',1,0]]),.5)
check('distinct group rates',solve([['a',1,1],['a',1,0],['b',1,1]]),.75)
check('perfect groups',solve([['a',1,1],['b',1,1]]),1)
check('empty',solve([]),0)
check('no positive group',solve([['a',0,1]]),0)
check('negative group omitted',solve([['a',1,1],['b',0,1]]),1)
check('grouped miss',solve([['a',1,0]]*N),0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
unequal group sizes0.50.5Passed
distinct group rates0.50.75Failed
perfect groups1.01Passed
empty0.00Passed
no positive group0.00Passed
negative group omitted0.51Failed
grouped miss0.00Passed

SHA-256 / 82e41ddeed1cc85a6d998fdf7782e8eda6b6798207fc7a09be1f16d63cb9220f

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Inputs are finite toy labels and scores; this defines no benchmark protocol, production metric library, or model quality claim. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-30T16:48:30.355847+00:00.

Case digest / cb9168e43ea10e5fc0b865430f62d4bca7fd2e5caa86575a1514bf28c5258dcc