FAILURE MAP
← Case archive

FA-97886 / Dataset split isolation / Open access

Dataset split: a group appears in multiple cross-validation folds · case 01

a group appears in multiple cross-validation folds.

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

ROOT CAUSE

Fold assignment cycles over rows instead of unique groups.

THE FAILURE

Fold assignment cycles over rows instead of unique groups.

Unsuccessful approach: Sorting rows first still rotates multiple rows of the same group separately.

Case contract

Rows [id,group]; assign sorted distinct groups round-robin to k folds and return [id,fold] in input order.

Why this case matters

This toy split allocator makes membership rules explicit for reproducible evaluation fixtures.

1 / The failure

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

N = 1
observations = []
def solve(rows, k):
    return [[i,j%k] for j,(i,g) in enumerate(rows)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated group same fold',solve([['a','g'],['b','h'],['c','g']],2),[['a',0],['b',1],['c',0]])
check('one group',solve([['a','g']],3),[['a',0]])
check('empty',solve([],2),[])
check('lexical rotation',solve([['x','z'],['y','a']],2),[['x',1],['y',0]])
check('three groups',solve([['a','c'],['b','b'],['c','a']],2),[['a',0],['b',1],['c',0]])
check('single fold',solve([['a','x'],['b','y']],1),[['a',0],['b',0]])
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
repeated group same fold[['a', 0], ['b', 1], ['c', 0]][['a', 0], ['b', 1], ['c', 0]]Passed
one group[['a', 0]][['a', 0]]Passed
empty[][]Passed
lexical rotation[['x', 0], ['y', 1]][['x', 1], ['y', 0]]Failed
three groups[['a', 0], ['b', 1], ['c', 0]][['a', 0], ['b', 1], ['c', 0]]Passed
single fold[['a', 0], ['b', 0]][['a', 0], ['b', 0]]Passed

SHA-256 / f3a3c7e3306e9edcf28473a58ac7cb64faea7a42c2390c576890801e9266fc94

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(rows, k):
    return [[i,j%k] for j,(i,g) in enumerate(sorted(rows,key=lambda r:r[1]))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('repeated group same fold',solve([['a','g'],['b','h'],['c','g']],2),[['a',0],['b',1],['c',0]])
check('one group',solve([['a','g']],3),[['a',0]])
check('empty',solve([],2),[])
check('lexical rotation',solve([['x','z'],['y','a']],2),[['x',1],['y',0]])
check('three groups',solve([['a','c'],['b','b'],['c','a']],2),[['a',0],['b',1],['c',0]])
check('single fold',solve([['a','x'],['b','y']],1),[['a',0],['b',0]])
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
repeated group same fold[['a', 0], ['c', 1], ['b', 0]][['a', 0], ['b', 1], ['c', 0]]Failed
one group[['a', 0]][['a', 0]]Passed
empty[][]Passed
lexical rotation[['y', 0], ['x', 1]][['x', 1], ['y', 0]]Failed
three groups[['c', 0], ['b', 1], ['a', 0]][['a', 0], ['b', 1], ['c', 0]]Failed
single fold[['a', 0], ['b', 0]][['a', 0], ['b', 0]]Passed

SHA-256 / 2b1d62c0bbcc52e058fbd5f6638a22878bdd10823921391bc2fe177abdf37ace

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 6 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

Inputs are small in-memory records with self-contained contracts; no claim is made about production sampling quality. 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:07.116766+00:00.

Case digest / 3636d5cc6db3408bf359690b8bc9d6dc10c1f3e22b2943b748bad34f6b91e019