FAILURE MAP
← Case archive

FA-100396 / Feature preprocessing fit scope / Open access

Training frequency encoding applies fitted state incorrectly · case 01

Training frequency encoding 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

Encode each scalar string with its relative frequency in the training sequence. Unseen values map to zero; an empty training sequence maps all transforms to zero.

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):
    from collections import Counter
    c=Counter(train); return [c[x]/len(train) if x in c else (1/len(train) if train else 0) for x in values]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='a'+str(N); check('relative frequencies',solve([a,a,'b'],[a,'b','z']),[2/3,1/3,0])
check('heldout does not alter frequency',solve(['x','y'],['x']),[0.5])
check('empty transform',solve(['x'],[]),[])
check('empty train unknown',solve([],['x']),[0])
check('all same',solve(['x']*N,['x']),[1.0])
check('unseen is zero',solve(['x','x'],['z']),[0])
check('single observed class',solve(['a','b','b'],['b']),[2/3])
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
relative frequencies[0.6666666666666666, 0.3333333333333333, 0.3333333333333333][0.6666666666666666, 0.3333333333333333, 0]Failed
heldout does not alter frequency[0.5][0.5]Passed
empty transform[][]Passed
empty train unknown[0][0]Passed
all same[1.0][1.0]Passed
unseen is zero[0.5][0]Failed
single observed class[0.6666666666666666][0.6666666666666666]Passed

SHA-256 / 742e3cd6e2c6640db4fd6ceaa2e8ed727d07a0a7a58a46ba6636f314cdf10b86

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(train, values):
    from collections import Counter
    c=Counter(train); return [c[x]/(len(train)+1) for x in values]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
a='a'+str(N); check('relative frequencies',solve([a,a,'b'],[a,'b','z']),[2/3,1/3,0])
check('heldout does not alter frequency',solve(['x','y'],['x']),[0.5])
check('empty transform',solve(['x'],[]),[])
check('empty train unknown',solve([],['x']),[0])
check('all same',solve(['x']*N,['x']),[1.0])
check('unseen is zero',solve(['x','x'],['z']),[0])
check('single observed class',solve(['a','b','b'],['b']),[2/3])
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
relative frequencies[0.5, 0.25, 0.0][0.6666666666666666, 0.3333333333333333, 0]Failed
heldout does not alter frequency[0.3333333333333333][0.5]Failed
empty transform[][]Passed
empty train unknown[0.0][0]Passed
all same[0.5][1.0]Failed
unseen is zero[0.0][0]Passed
single observed class[0.5][0.6666666666666666]Failed

SHA-256 / f3aa29c444968c397b5fb7337f6b814c570886e829774e56dc8be83480466fad

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 empirical category rate encoding; smoothing and target statistics are not modeled. 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.936459+00:00.

Case digest / f3a82a63e40604d20b60cb26b3efe1891bf294aeb124c54c610123545fb095c6