FAILURE MAP
← Case archive

FA-99991 / Evaluation metric aggregation / Open access

Top k accuracy divides by candidate slots · case 01

Top k accuracy divides by candidate slots.

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

ROOT CAUSE

The hit rate is reduced by padded candidate positions.

THE FAILURE

The hit rate is reduced by padded candidate positions.

Unsuccessful approach: Counting duplicate candidate slots can credit a single example more than once.

Case contract

Given target labels and candidate rows, return the fraction of rows containing their target; empty inputs yield 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(targets, candidates):
    hits=sum(t in row for t,row in zip(targets,candidates)); slots=sum(len(row) for row in candidates); return hits/slots if slots else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ragged candidates',solve([1,2],[[1,0,3],[2]]),1)
check('one miss',solve([1,2],[[1],[0]]),.5)
check('duplicate hit counted once',solve([1],[[1,1,1]]),1)
check('empty',solve([],[]),0)
check('singleton hit',solve([N],[[N]]),1)
check('singleton miss',solve([N],[[N+1]]),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
ragged candidates0.51Failed
one miss0.50.5Passed
duplicate hit counted once0.33333333333333331Failed
empty00Passed
singleton hit1.01Passed
singleton miss0.00Passed

SHA-256 / b70ffac04f76f8cd5581e333d829c11fe5768f6251a85ede9a65c1eade690387

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(targets, candidates):
    hits=sum(t in row for t,row in zip(targets,candidates)); return hits/(len(targets)+1) if targets else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('ragged candidates',solve([1,2],[[1,0,3],[2]]),1)
check('one miss',solve([1,2],[[1],[0]]),.5)
check('duplicate hit counted once',solve([1],[[1,1,1]]),1)
check('empty',solve([],[]),0)
check('singleton hit',solve([N],[[N]]),1)
check('singleton miss',solve([N],[[N+1]]),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
ragged candidates0.66666666666666661Failed
one miss0.33333333333333330.5Failed
duplicate hit counted once0.51Failed
empty00Passed
singleton hit0.51Failed
singleton miss0.00Passed

SHA-256 / ff3f1704fba029b06ca8fa7aa1d80a5c5ec702cc97f1683fb9b98ea6622de8aa

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

Case digest / c463398b020552dff6c14d506df2931021b56660f097251964a04d17a325f534