FA-100406 / Feature preprocessing fit scope / Open access
Median imputation applies fitted state incorrectly · case 01
Median imputation 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
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 train if x is not None); m=v[(len(v)-1)//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 | [0] | [2] | Failed |
| heldout does not affect median | [1, 100] | [4, 100] | Failed |
| all missing fit | [0] | [0] | Passed |
| no gaps | [8] | [8] | Passed |
| singleton | [1] | [1] | Passed |
| empty transform | [] | [] | Passed |
SHA-256 / 23c75aed33002a1c5fe52aae8db7492e00055c8de9531cf60c60a4049624f465
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 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 / 413bfaa5913e9d61c833cf6ac7161716f884df9f018199ee7416cf3a64156f1e
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.363215+00:00.
Case digest / d22fad577753b3b6b60099cfe18dd669f2c29cc5612b467ed94c0533cf9d07df