FAILURE MAP
← Case archive

FA-99976 / Evaluation metric aggregation / Open access

Balanced accuracy uses ordinary accuracy · case 01

Balanced accuracy uses ordinary accuracy.

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

ROOT CAUSE

The per-class recalls are collapsed into a support-weighted global score.

THE FAILURE

The per-class recalls are collapsed into a support-weighted global score.

Unsuccessful approach: Adding a fixed count to each class recall changes perfect results for small samples.

Case contract

Return the unweighted mean recall for labels 0 and 1; an absent class has recall 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(truth, pred):
    return sum(a==b for a,b in zip(truth,pred))/len(truth) if truth else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rare class',solve([0]*N+[1],[0]*N+[0]),.5)
check('perfect',solve([0,1],[0,1]),1)
check('both wrong',solve([0,1],[1,0]),0)
check('absent positive',solve([0]*N,[0]*N),.5)
check('empty',solve([],[]),0)
check('singleton positive hit',solve([1],[1]),.5)
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
rare class0.50.5Passed
perfect1.01Passed
both wrong0.00Passed
absent positive1.00.5Failed
empty00Passed
singleton positive hit1.00.5Failed

SHA-256 / cee1d3ca5f0bdfd68ff121d591e40175012e98fc9c3219f20592f1781ee9e06e

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(truth, pred):
    return sum((sum(a==k and b==k for a,b in zip(truth,pred))+1)/(sum(a==k for a in truth)+1) for k in (0,1))/2
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('rare class',solve([0]*N+[1],[0]*N+[0]),.5)
check('perfect',solve([0,1],[0,1]),1)
check('both wrong',solve([0,1],[1,0]),0)
check('absent positive',solve([0]*N,[0]*N),.5)
check('empty',solve([],[]),0)
check('singleton positive hit',solve([1],[1]),.5)
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
rare class0.750.5Failed
perfect1.01Passed
both wrong0.50Failed
absent positive1.00.5Failed
empty1.00Failed
singleton positive hit1.00.5Failed

SHA-256 / 656662b56951b06ffe8516d5f0f3953a3549709029a8298f53d8cd64ab98e700

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 6 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.355536+00:00.

Case digest / 52f1897348f16fcfb161908a7740bdccf8dcdfb2f5dbf84625da62ffa09c62c3