FA-100376 / Feature preprocessing fit scope / Open access
Category vocabulary encoding applies fitted state incorrectly · case 01
Category vocabulary encoding applies fitted state incorrectly.
ROOT CAUSE
The transform applies a plausible but incorrect state convention.
THE FAILURE
The transform applies a plausible but incorrect state convention.
Unsuccessful approach: The partial repair addresses the main convention but mishandles an edge case.
Case contract
Fit sorted unique string classes from train and return their zero-based positions for transform values; any unseen string receives sentinel -1.
Why this case matters
A small deterministic preprocessing contract makes the fit boundary and transform behavior directly inspectable.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(train, values):
vocab=sorted(set(train)); return [vocab.index(x) if x in vocab else len(vocab) for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='c'+str(N); train=['b',a]; vals=[a,'b','u'+str(N),'']; check('lexical train ids',solve(train,vals),[1,0,-1,-1])
check('heldout category unknown',solve(['a','c'],['b']),[-1])
check('repeat',solve(['z','a','z'],['z','z']),[1,1])
check('empty values',solve(['a'],[]),[])
check('empty fit',solve([],['a']),[-1])
check('empty string unknown',solve(['a'],['']),[-1])
check('known singleton',solve(['x'],['x']),[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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| lexical train ids | [1, 0, 2, 2] | [1, 0, -1, -1] | Failed |
| heldout category unknown | [2] | [-1] | Failed |
| repeat | [1, 1] | [1, 1] | Passed |
| empty values | [] | [] | Passed |
| empty fit | [0] | [-1] | Failed |
| empty string unknown | [1] | [-1] | Failed |
| known singleton | [0] | [0] | Passed |
SHA-256 / 86ed59f040909c8eed30602a0b4060e7fef0093adf2bab2e376d4bf89db4f817
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(train, values):
vocab=sorted(set(train)); return [vocab.index(x) if x in vocab else (len(vocab) if x!='' else -1) for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='c'+str(N); train=['b',a]; vals=[a,'b','u'+str(N),'']; check('lexical train ids',solve(train,vals),[1,0,-1,-1])
check('heldout category unknown',solve(['a','c'],['b']),[-1])
check('repeat',solve(['z','a','z'],['z','z']),[1,1])
check('empty values',solve(['a'],[]),[])
check('empty fit',solve([],['a']),[-1])
check('empty string unknown',solve(['a'],['']),[-1])
check('known singleton',solve(['x'],['x']),[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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| lexical train ids | [1, 0, 2, -1] | [1, 0, -1, -1] | Failed |
| heldout category unknown | [2] | [-1] | Failed |
| repeat | [1, 1] | [1, 1] | Passed |
| empty values | [] | [] | Passed |
| empty fit | [0] | [-1] | Failed |
| empty string unknown | [-1] | [-1] | Passed |
| known singleton | [0] | [0] | Passed |
SHA-256 / 314d5a37fc2847a3394df8521092458164a588ecb02751e8e5549d320fa34da9
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
Toy categorical ordinal encoding with deterministic lexical order and a single unknown sentinel. 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:34.921201+00:00.
Case digest / 83f2f9853eb674574689da3bb51c6b65cafda28bf5fb3697e0245069fd074529