FA-100341 / Feature preprocessing fit scope / Open access
Mean imputation uses held-out rows while fitting · case 01
Mean 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 transform are row lists of one numeric feature with None missing. Fit the arithmetic mean of observed training values (0 when none); replace transform missing values only.
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, rows):
allv=[x for row in rows for x in row if x is not None]; m=sum(allv)/len(allv) if allv else 0
return [[m if x is None else x for x in row] for row in rows]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a=[[None,2+N],[4+N,None]]; check('two gaps',solve([[1+N],[3+N]],a),[[2+N,2+N],[4+N,2+N]])
check('heldout cannot move mean',solve([[2+N]],[[None]]),[[2+N]])
check('all missing fit',solve([[None]],[[None,7]]),[[0,7]])
check('no missing values',solve([[2]],[[N,3]]),[[N,3]])
check('empty transform',solve([[2]],[]),[])
check('negative training mean',solve([[-N,-N-2]],[[None]]),[[-N-1]])
check('singleton fit',solve([[N]],[[None]]),[[N]])
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 |
|---|---|---|---|
| two gaps | [[4.0, 3], [5, 4.0]] | [[3, 3], [5, 3]] | Failed |
| heldout cannot move mean | [[0]] | [[3]] | Failed |
| all missing fit | [[7.0, 7]] | [[0, 7]] | Failed |
| no missing values | [[1, 3]] | [[1, 3]] | Passed |
| empty transform | [] | [] | Passed |
| negative training mean | [[0]] | [[-2]] | Failed |
| singleton fit | [[0]] | [[1]] | Failed |
SHA-256 / e11cabd95abba7bbcab08e6e9e1cab27f826d9e11619d493f8211d937fd6a239
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(train, rows):
m=sum(x for row in train+rows for x in row if x is not None)/sum(x is not None for row in train+rows for x in row) if any(cell is not None for row in train+rows for cell in row) else 0
return [[m if x is None else x for x in row] for row in rows]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a=[[None,2+N],[4+N,None]]; check('two gaps',solve([[1+N],[3+N]],a),[[2+N,2+N],[4+N,2+N]])
check('heldout cannot move mean',solve([[2+N]],[[None]]),[[2+N]])
check('all missing fit',solve([[None]],[[None,7]]),[[0,7]])
check('no missing values',solve([[2]],[[N,3]]),[[N,3]])
check('empty transform',solve([[2]],[]),[])
check('negative training mean',solve([[-N,-N-2]],[[None]]),[[-N-1]])
check('singleton fit',solve([[N]],[[None]]),[[N]])
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 |
|---|---|---|---|
| two gaps | [[3.5, 3], [5, 3.5]] | [[3, 3], [5, 3]] | Failed |
| heldout cannot move mean | [[3.0]] | [[3]] | Passed |
| all missing fit | [[7.0, 7]] | [[0, 7]] | Failed |
| no missing values | [[1, 3]] | [[1, 3]] | Passed |
| empty transform | [] | [] | Passed |
| negative training mean | [[-2.0]] | [[-2]] | Passed |
| singleton fit | [[1.0]] | [[1]] | Passed |
SHA-256 / ab22fefe506b8091462220508e569c47afbc7a98db39175e932092b8c6750b50
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 one-column numeric imputer; no dataframe, dtype, or multi-column behavior is implied. 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.471828+00:00.
Case digest / 65aa2752a13ce3b8c1301cafec77e3f6112d2176082dcb7e6048f423d3349497