FAILURE MAP
← Case archive

FA-14216 / Numerical aggregation / Open access

Group balanced squared loss: Each group retains only its latest residual. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

Each group retains only its latest residual.

THE FAILURE

Each group retains only its latest residual.

Unsuccessful approach: Keeping only the first residual is equally order-dependent.

Case contract

Rows [group label, integer residual or None] are reduced into mean squared residual per group, then arithmetic mean across observed groups. Missing residuals contribute neither count nor group presence; group labels are case-sensitive. Empty observed population returns None. Exact Fraction string.

Why this case matters

Exact bounded examples isolate a reduction defect without floating-point or external-service effects.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups[label]=[error]
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
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
regression 11037/4Failed
regression 225/221/2Failed
regression 3NoneNonePassed
regression 4NoneNonePassed
regression 55/27/2Failed
regression 65/25/2Passed
regression 71010Passed
regression 877Passed
variable group balance5/25/2Passed

SHA-256 / 86e30ea822c6753edad81c1aad902e703c1d7206a032a7aa13b9481f59383eb4

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
from collections import Counter, defaultdict
import math
import itertools
N = 1
observations = []
def solve(rows):
    groups={}
    for label,error in rows:
        if error is None: continue
        groups.setdefault(label,[error])
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(sum(means)/len(means))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([('a', 1), ('a', 2), ('b', 4)],)), '37/4')
check('regression 2', solve(*([('a', 1), ('a', 3), ('b', 4)],)), '21/2')
check('regression 3', solve(*([],)), None)
check('regression 4', solve(*([('a', None), ('b', None)],)), None)
check('regression 5', solve(*([('a', 0), ('a', 2), ('b', -3), ('b', 1)],)), '7/2')
check('regression 6', solve(*([('a', 1), ('b', 2), ('b', 2), ('b', 2)],)), '5/2')
check('regression 7', solve(*([('a', None), ('a', 2), ('b', 4)],)), '10')
check('regression 8', solve(*([('A', 1), ('a', 4), ('B', 2)],)), '7')
check("variable group balance",solve([("a",N),("a",-N),("b",2*N)]),str(Fraction(5*N*N,2)))
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
regression 117/237/4Failed
regression 217/221/2Failed
regression 3NoneNonePassed
regression 4NoneNonePassed
regression 59/27/2Failed
regression 65/25/2Passed
regression 71010Passed
regression 877Passed
variable group balance5/25/2Passed

SHA-256 / 1cf807ed65bfe80754f77301f235589b209c910256ce65e3c6a66ac692ede555

HELD IN THE MEMBER ARCHIVE

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

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

Small offline integer/rational inputs only; no performance, statistical inference, or production-library conformance claim. 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-29T14:39:14.981710+00:00.

Case digest / c773940cd09a86bf385c9a7148ad43b1fd7ce83fee0eec7baa5f51bd3c40b14b