FA-100391 / Feature preprocessing fit scope / Open access
Training frequency encoding uses held-out rows while fitting · case 01
Training frequency 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
Encode each scalar string with its relative frequency in the training sequence. Unseen values map to zero; an empty training sequence maps all transforms to zero.
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):
from collections import Counter
c=Counter(train+values); return [c[x]/len(train+values) if train+values else 0 for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='a'+str(N); check('relative frequencies',solve([a,a,'b'],[a,'b','z']),[2/3,1/3,0])
check('heldout does not alter frequency',solve(['x','y'],['x']),[0.5])
check('empty transform',solve(['x'],[]),[])
check('empty train unknown',solve([],['x']),[0])
check('all same',solve(['x']*N,['x']),[1.0])
check('unseen is zero',solve(['x','x'],['z']),[0])
check('single observed class',solve(['a','b','b'],['b']),[2/3])
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 |
|---|---|---|---|
| relative frequencies | [0.5, 0.3333333333333333, 0.16666666666666666] | [0.6666666666666666, 0.3333333333333333, 0] | Failed |
| heldout does not alter frequency | [0.6666666666666666] | [0.5] | Failed |
| empty transform | [] | [] | Passed |
| empty train unknown | [1.0] | [0] | Failed |
| all same | [1.0] | [1.0] | Passed |
| unseen is zero | [0.3333333333333333] | [0] | Failed |
| single observed class | [0.75] | [0.6666666666666666] | Failed |
SHA-256 / f39a7470db317a7ed92db1e099a47ce91ecaf6c3b6b7c084ca00636ccc6b18c6
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(train, values):
from collections import Counter
c=Counter(train+values); return [c[x]/len(train) if train else 0 for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='a'+str(N); check('relative frequencies',solve([a,a,'b'],[a,'b','z']),[2/3,1/3,0])
check('heldout does not alter frequency',solve(['x','y'],['x']),[0.5])
check('empty transform',solve(['x'],[]),[])
check('empty train unknown',solve([],['x']),[0])
check('all same',solve(['x']*N,['x']),[1.0])
check('unseen is zero',solve(['x','x'],['z']),[0])
check('single observed class',solve(['a','b','b'],['b']),[2/3])
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 |
|---|---|---|---|
| relative frequencies | [1.0, 0.6666666666666666, 0.3333333333333333] | [0.6666666666666666, 0.3333333333333333, 0] | Failed |
| heldout does not alter frequency | [1.0] | [0.5] | Failed |
| empty transform | [] | [] | Passed |
| empty train unknown | [0] | [0] | Passed |
| all same | [2.0] | [1.0] | Failed |
| unseen is zero | [0.5] | [0] | Failed |
| single observed class | [1.0] | [0.6666666666666666] | Failed |
SHA-256 / dee0d53e0fd8cb9fd804e5688eb373f37544b7111cdcdd194599d170897a3922
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 empirical category rate encoding; smoothing and target statistics are not modeled. 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.921113+00:00.
Case digest / 95d14a6966a8ab0acfd30b2da4b1bd928722e4fd632ffc548e916fd0ca44d6fd