FAILURE MAP
← Case archive

FA-100411 / Feature preprocessing fit scope / Open access

Median and interquartile scaling uses held-out rows while fitting · case 01

Median and interquartile scaling uses held-out rows while fitting.

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

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

Use linear-interpolated quartiles at positions p*(n-1), median at p=.5, and scale by Q3-Q1. A zero IQR maps all values to zero. Round to six decimals.

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(train); med=v[len(v)//2]; q1=v[len(v)//4]; q3=v[(3*len(v))//4]; d=q3-q1; return [round((x-med)/d,6) if d else 0 for x in values]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('quartile spread',solve([0,2,4,6],[0,3,6]),[-1,0,1])
check('heldout excluded',solve([0,2,4,6],[8]),[1.666667])
check('even median',solve([0,2,4,6],[3]),[0])
check('constant train',solve([N]*4,[N+2]),[0])
check('singleton',solve([N],[N+1]),[0])
check('negative values',solve([-6,-4,-2,0],[-4]),[-0.333333])
check('empty values',solve([0,2,4,6],[]),[])
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
quartile spread[-1.0, -0.25, 0.5][-1, 0, 1]Failed
heldout excluded[1.0][1.666667]Failed
even median[-0.25][0]Failed
constant train[0][0]Passed
singleton[0][0]Passed
negative values[-0.5][-0.333333]Failed
empty values[][]Passed

SHA-256 / 848c574b53203925ed31e2cbe001bcf48e18c8f3231eed84ec0a0ab2830327c6

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(train+values); med=v[len(v)//2]; q1=v[len(v)//4]; q3=v[(3*len(v))//4]; d=q3-q1; return [round((x-med)/d,6) if d else 0 for x in values]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('quartile spread',solve([0,2,4,6],[0,3,6]),[-1,0,1])
check('heldout excluded',solve([0,2,4,6],[8]),[1.666667])
check('even median',solve([0,2,4,6],[3]),[0])
check('constant train',solve([N]*4,[N+2]),[0])
check('singleton',solve([N],[N+1]),[0])
check('negative values',solve([-6,-4,-2,0],[-4]),[-0.333333])
check('empty values',solve([0,2,4,6],[]),[])
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
quartile spread[-0.5, 0.0, 0.5][-1, 0, 1]Failed
heldout excluded[1.0][1.666667]Failed
even median[0.0][0]Passed
constant train[0][0]Passed
singleton[0.0][0]Passed
negative values[0.0][-0.333333]Failed
empty values[][]Passed

SHA-256 / 482976293dd88fc1129d0c6e6f390bb8727a99b6c3a0fcdd297fe10775eba700

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 robust scalar scaler; quantiles use explicit linear interpolation over the sorted training values. 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.362678+00:00.

Case digest / 7788683d913d74123967e1676c45aed229760a6cefa7e3a09ad72709e2ab70ad