FAILURE MAP
← Case archive

FA-99986 / Evaluation metric aggregation / Open access

Grouped confusion counts average group matrices · case 01

Grouped confusion counts average group matrices.

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

ROOT CAUSE

Counts are divided by the number of groups even though they are event totals.

THE FAILURE

Counts are divided by the number of groups even though they are event totals.

Unsuccessful approach: Keeping only the largest per-cell group contribution loses counts from every other group.

Case contract

Rows are [group,actual,predicted]; return pooled [TP,FP,FN,TN] event counts.

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):
    groups={g for g,_,_ in rows}; return [sum(a==1 and p==1 for g,a,p in rows)//max(1,len(groups)),sum(a==0 and p==1 for g,a,p in rows)//max(1,len(groups)),sum(a==1 and p==0 for g,a,p in rows)//max(1,len(groups)),sum(a==0 and p==0 for g,a,p in rows)//max(1,len(groups))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two groups',solve([['a',1,1],['b',0,1],['b',1,0],['c',0,0]]),[1,1,1,1])
check('empty',solve([]),[0,0,0,0])
check('single hit',solve([['a',1,1]]),[1,0,0,0])
check('same cell across groups',solve([['a',1,1],['b',1,1]]),[2,0,0,0])
check('repeated group',solve([['a',0,0]]*N),[0,0,0,N])
check('false positives',solve([['a',0,1]]*N),[0,N,0,0])
check('all cells',solve([['x',1,1],['x',1,0],['y',0,1],['y',0,0]]),[1,1,1,1])
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
two groups[0, 0, 0, 0][1, 1, 1, 1]Failed
empty[0, 0, 0, 0][0, 0, 0, 0]Passed
single hit[1, 0, 0, 0][1, 0, 0, 0]Passed
same cell across groups[1, 0, 0, 0][2, 0, 0, 0]Failed
repeated group[0, 0, 0, 1][0, 0, 0, 1]Passed
false positives[0, 1, 0, 0][0, 1, 0, 0]Passed
all cells[0, 0, 0, 0][1, 1, 1, 1]Failed

SHA-256 / e47906a86c953201d9fa9db14157934452ff3a809a6c1161d3376d2e1cc9e56f

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows):
    groups={g for g,_,_ in rows}; tests=[(lambda a,p:a==1 and p==1),(lambda a,p:a==0 and p==1),(lambda a,p:a==1 and p==0),(lambda a,p:a==0 and p==0)]; return [max(sum(test(a,p) for gg,a,p in rows if gg==g) for g in groups) for test in tests] if groups else [0,0,0,0]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('two groups',solve([['a',1,1],['b',0,1],['b',1,0],['c',0,0]]),[1,1,1,1])
check('empty',solve([]),[0,0,0,0])
check('single hit',solve([['a',1,1]]),[1,0,0,0])
check('same cell across groups',solve([['a',1,1],['b',1,1]]),[2,0,0,0])
check('repeated group',solve([['a',0,0]]*N),[0,0,0,N])
check('false positives',solve([['a',0,1]]*N),[0,N,0,0])
check('all cells',solve([['x',1,1],['x',1,0],['y',0,1],['y',0,0]]),[1,1,1,1])
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
two groups[1, 1, 1, 1][1, 1, 1, 1]Passed
empty[0, 0, 0, 0][0, 0, 0, 0]Passed
single hit[1, 0, 0, 0][1, 0, 0, 0]Passed
same cell across groups[1, 0, 0, 0][2, 0, 0, 0]Failed
repeated group[0, 0, 0, 1][0, 0, 0, 1]Passed
false positives[0, 1, 0, 0][0, 1, 0, 0]Passed
all cells[1, 1, 1, 1][1, 1, 1, 1]Passed

SHA-256 / 8ac7774ed86822e005dfff45b27aed9101e018f71c59e4917ad88c82c030fa69

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.356111+00:00.

Case digest / 705eb76226475c429b77dcb6f3a6916f05cc79083be2c81077f173de31e6b1eb