FAILURE MAP
← Case archive

FA-14226 / Numerical aggregation / Open access

Group balanced squared loss: Worst-group loss replaces the group average. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

Worst-group loss replaces the group average.

THE FAILURE

Worst-group loss replaces the group average.

Unsuccessful approach: Best-group loss also does not average across observed groups.

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.setdefault(label,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(max(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 11637/4Failed
regression 21621/2Failed
regression 3NoneNonePassed
regression 4NoneNonePassed
regression 557/2Failed
regression 645/2Failed
regression 71610Failed
regression 8167Failed
variable group balance45/2Failed

SHA-256 / af90ae548c4d3e1ecf37733db2eba77c63ecbf8ccb5157d0c672d4aab4f18418

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,[]).append(error)
    if not groups: return None
    means=[Fraction(sum(e*e for e in values),len(values)) for values in groups.values()]
    return str(min(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 15/237/4Failed
regression 2521/2Failed
regression 3NoneNonePassed
regression 4NoneNonePassed
regression 527/2Failed
regression 615/2Failed
regression 7410Failed
regression 817Failed
variable group balance15/2Failed

SHA-256 / 87641a2de577ce0da5d477c57919f84cadccd374b95c0fd81a0454117f9f76e4

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 / b6a9b6dc07ffcd112174de0e6da3e371e7ced8e52c01752eba317fc92fabda75