FAILURE MAP
← Case archive

FA-99961 / Evaluation metric aggregation / Open access

Support weighted recall divides by label count · case 01

Support weighted recall divides by label count.

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

ROOT CAUSE

The weighted sum uses the number of classes instead of total support.

THE FAILURE

The weighted sum uses the number of classes instead of total support.

Unsuccessful approach: Weighting by predicted counts shifts emphasis toward overpredicted labels.

Case contract

Return support-weighted recall for supplied labels; labels without support contribute zero; no support returns 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, labels):
    return sum(sum(a==k and b==k for a,b in zip(truth,pred))/sum(a==k for a in truth)*sum(a==k for a in truth) for k in labels)/len(labels) if labels and truth else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('support weighted',solve([0,0,0,1],[0,1,1,1],[0,1]),.5)
check('perfect',solve([0,1],[0,1],[0,1]),1)
check('all wrong',solve([0,1],[1,0],[0,1]),0)
check('empty labels',solve([0],[0],[]),0)
check('empty data',solve([],[],[0,1]),0)
check('single class',solve([N]*N,[N]*N,[N]),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
support weighted1.00.5Failed
perfect1.01Passed
all wrong0.00Passed
empty labels00Passed
empty data00Passed
single class1.01Passed

SHA-256 / 30dfa707be8aac2097c6e75ac715e5330cbbb3aab69107b2f6d82380eb42a339

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(truth, pred, labels):
    return sum((sum(a==k and b==k for a,b in zip(truth,pred))/sum(a==k for a in truth) if sum(a==k for a in truth) else 0)*sum(b==k for b in pred) for k in labels)/len(truth) if truth else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('support weighted',solve([0,0,0,1],[0,1,1,1],[0,1]),.5)
check('perfect',solve([0,1],[0,1],[0,1]),1)
check('all wrong',solve([0,1],[1,0],[0,1]),0)
check('empty labels',solve([0],[0],[]),0)
check('empty data',solve([],[],[0,1]),0)
check('single class',solve([N]*N,[N]*N,[N]),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
support weighted0.83333333333333340.5Failed
perfect1.01Passed
all wrong0.00Passed
empty labels0.00Passed
empty data00Passed
single class1.01Passed

SHA-256 / 556cab67d59d138a74afce695e71cd3df8894c1d2e4b250aae24fc521a1cd22b

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

Case digest / ffed7376318af49ff220b0adb1aa03f67990db8e1c2c41b4a45c0f2163d82ee3