FA-100371 / Feature preprocessing fit scope / Open access
Category vocabulary encoding uses held-out rows while fitting · case 01
Category vocabulary encoding uses held-out rows while fitting.
ROOT CAUSE
Fitting reads values outside the designated training rows.
THE FAILURE
Fitting reads values outside the designated training rows.
Unsuccessful approach: Filtering rows after computing the statistic still leaves held-out influence.
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+values)); return [vocab.index(x) if x in vocab 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 | [2, 1, 3, 0] | [1, 0, -1, -1] | Failed |
| heldout category unknown | [1] | [-1] | Failed |
| repeat | [1, 1] | [1, 1] | Passed |
| empty values | [] | [] | Passed |
| empty fit | [0] | [-1] | Failed |
| empty string unknown | [0] | [-1] | Failed |
| known singleton | [0] | [0] | Passed |
SHA-256 / 710c7c3fa13ea05b33703870f96268860bd32012eedc9aeab85002e51d34bc4e
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+values)); return [vocab.index(x) 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 | [2, 1, 3, 0] | [1, 0, -1, -1] | Failed |
| heldout category unknown | [1] | [-1] | Failed |
| repeat | [1, 1] | [1, 1] | Passed |
| empty values | [] | [] | Passed |
| empty fit | [0] | [-1] | Failed |
| empty string unknown | [0] | [-1] | Failed |
| known singleton | [0] | [0] | Passed |
SHA-256 / 948aba7cf5d5bb109518236d4d1799ac68b75a8e15ea25d97529399a08c0314d
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.921039+00:00.
Case digest / 996095f1da714491522c958419c5fdd6ad53c2981118b3ad705733d2a5724da0