FAILURE MAP
← Case archive

FA-97991 / Training label alignment / Open access

A class permutation is applied in the wrong direction · case 01

A class permutation is applied in the wrong direction.

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

ROOT CAUSE

A source-to-target class map is mistaken for a target-to-source map.

THE FAILURE

A source-to-target class map is mistaken for a target-to-source map.

Unsuccessful approach: Sorting the permutation values loses the association between old and new class identities.

Case contract

Given labels and permutation where permutation[new_index]=old_index, return remapped labels; out-of-range labels are -1.

Why this case matters

A small deterministic training-data operation makes label ownership and ordering explicit.

1 / The failure

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

N = 1
observations = []
def solve(labels, permutation):
    return [permutation[y] if 0<=y<len(permutation) else -1 for y in labels]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('noninvolutive map',solve([0,1,2],[1,2,0]),[2,0,1])
check('out of range',solve([3,-1],[1,0]),[-1,-1])
check('empty labels',solve([],[1,0]),[])
check('identity map',solve([0,1],[0,1]),[0,1])
check('single class',solve([0],[0]),[0])
check('mixed valid invalid',solve([2,0,4],[2,0,1]),[0,1,-1])
check('swap map',solve([0,1],[1,0]),[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
noninvolutive map[1, 2, 0][2, 0, 1]Failed
out of range[-1, -1][-1, -1]Passed
empty labels[][]Passed
identity map[0, 1][0, 1]Passed
single class[0][0]Passed
mixed valid invalid[1, 2, -1][0, 1, -1]Failed
swap map[1, 0][1, 0]Passed

SHA-256 / 8840c4a1abc152815e44fe269f35b04eb4b6238b3d5b15814e910d6958aeebef

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(labels, permutation):
    return [sorted(permutation)[y] if 0<=y<len(permutation) else -1 for y in labels]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('noninvolutive map',solve([0,1,2],[1,2,0]),[2,0,1])
check('out of range',solve([3,-1],[1,0]),[-1,-1])
check('empty labels',solve([],[1,0]),[])
check('identity map',solve([0,1],[0,1]),[0,1])
check('single class',solve([0],[0]),[0])
check('mixed valid invalid',solve([2,0,4],[2,0,1]),[0,1,-1])
check('swap map',solve([0,1],[1,0]),[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
noninvolutive map[0, 1, 2][2, 0, 1]Failed
out of range[-1, -1][-1, -1]Passed
empty labels[][]Passed
identity map[0, 1][0, 1]Passed
single class[0][0]Passed
mixed valid invalid[2, 0, -1][0, 1, -1]Failed
swap map[0, 1][1, 0]Failed

SHA-256 / fb0e000b6b9885743508ccd49a5126d10fb8e82afba400c2bf0e4396879afdae

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

Permutation values are unique indices; labels are integer indices. 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:07.975853+00:00.

Case digest / 9e939c807295be9ab99a37556c2f0aa61191e0e976a82ffe1fba22f3cf3f2060