FAILURE MAP
← Case archive

FA-14206 / Numerical aggregation / Open access

Group balanced squared loss: Missing residuals are imputed as zero and counted. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

Missing residuals are imputed as zero and counted.

THE FAILURE

Missing residuals are imputed as zero and counted.

Unsuccessful approach: A nonzero default also invents residual evidence and group presence.

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: error=0
        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(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 137/437/4Passed
regression 221/221/2Passed
regression 3NoneNonePassed
regression 40NoneFailed
regression 57/27/2Passed
regression 65/25/2Passed
regression 7910Failed
regression 877Passed
variable group balance5/25/2Passed

SHA-256 / 37d64c35d3f30027991be967403e2250db343085cc2e25872df77467dc8aaf30

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: error=1
        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(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 137/437/4Passed
regression 221/221/2Passed
regression 3NoneNonePassed
regression 41NoneFailed
regression 57/27/2Passed
regression 65/25/2Passed
regression 737/410Failed
regression 877Passed
variable group balance5/25/2Passed

SHA-256 / a187b3bb8f7f19c45ccab91b1b1f4da63c6b15b3185143d3e9c63d3c77d70cc0

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