FAILURE MAP
← Case archive

FA-100346 / Feature preprocessing fit scope / Open access

Mean imputation applies fitted state incorrectly · case 01

Mean imputation applies fitted state incorrectly.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

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 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):
    m=sum(x for row in train for x in row if x is not None)/sum(x is not None for row in train for x in row) if any(cell is not None for row in train for cell in row) else 0
    return [[0 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 fixtureActualExpectedOutcome
two gaps[[0, 3], [5, 0]][[3, 3], [5, 3]]Failed
heldout cannot move mean[[0]][[3]]Failed
all missing fit[[0, 7]][[0, 7]]Passed
no missing values[[1, 3]][[1, 3]]Passed
empty transform[][]Passed
negative training mean[[0]][[-2]]Failed
singleton fit[[0]][[1]]Failed

SHA-256 / a49d91581ab48cf8f398a963f5e82771753f2f8b5b09d5412422e72005b964e2

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(train, rows):
    v=[x for row in train for x in row if x is not None]; m=v[0] if v 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 fixtureActualExpectedOutcome
two gaps[[2, 3], [5, 2]][[3, 3], [5, 3]]Failed
heldout cannot move mean[[3]][[3]]Passed
all missing fit[[0, 7]][[0, 7]]Passed
no missing values[[1, 3]][[1, 3]]Passed
empty transform[][]Passed
negative training mean[[-1]][[-2]]Failed
singleton fit[[1]][[1]]Passed

SHA-256 / d98378d6a8c15d86262ecde782478dc09bd43917a77183638c3605311120e3c6

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.472005+00:00.

Case digest / 699e8690d43f77c9fc71603176db8b51219fb8c706ea175f8ada41e14904cc10