FA-100401 / Feature preprocessing fit scope / Open access
Median imputation uses held-out rows while fitting · case 01
Median imputation 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
Train and values are scalar numeric lists with optional None. Fit the ordinary median, averaging the two middle observations for even size; use zero if no observations.
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):
v=sorted(x for x in values if x is not None); m=v[len(v)//2] if v else 0; return [m if x is None else x for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('odd training',solve([1,5,9],[None,4]),[5,4])
check('even training midpoint',solve([0,4],[None]),[2])
check('heldout does not affect median',solve([1,7],[None,100]),[4,100])
check('all missing fit',solve([None],[None]),[0])
check('no gaps',solve([1,2],[8]),[8])
check('singleton',solve([N],[None]),[N])
check('empty transform',solve([1],[]),[])
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 |
|---|---|---|---|
| odd training | [4, 4] | [5, 4] | Failed |
| even training midpoint | [0] | [2] | Failed |
| heldout does not affect median | [100, 100] | [4, 100] | Failed |
| all missing fit | [0] | [0] | Passed |
| no gaps | [8] | [8] | Passed |
| singleton | [0] | [1] | Failed |
| empty transform | [] | [] | Passed |
SHA-256 / e002d04741fa6c9dde02ec8e727757f68d434bf938522b5fcf965644b1c1251d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(train, values):
v=sorted(x for x in train+values if x is not None); m=v[len(v)//2] if v else 0; return [m if x is None else x for x in values]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('odd training',solve([1,5,9],[None,4]),[5,4])
check('even training midpoint',solve([0,4],[None]),[2])
check('heldout does not affect median',solve([1,7],[None,100]),[4,100])
check('all missing fit',solve([None],[None]),[0])
check('no gaps',solve([1,2],[8]),[8])
check('singleton',solve([N],[None]),[N])
check('empty transform',solve([1],[]),[])
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 |
|---|---|---|---|
| odd training | [5, 4] | [5, 4] | Passed |
| even training midpoint | [4] | [2] | Failed |
| heldout does not affect median | [7, 100] | [4, 100] | Failed |
| all missing fit | [0] | [0] | Passed |
| no gaps | [8] | [8] | Passed |
| singleton | [1] | [1] | Passed |
| empty transform | [] | [] | Passed |
SHA-256 / 0c0d72f0db99df614416065941d8a740726e02ca38c4e491bef34d6fe319b71c
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 scalar median imputer with an explicit even-sample midpoint rule. 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:35.337343+00:00.
Case digest / 4c3f4048109f9cce5255a50eaf0435fcd0b2592dbc9038f6d518045a0c7ac51b