FAILURE MAP
← Case archive

FA-6331 / Statistics / Open access

Effective sample size weights · case 01

Nominal record count ignores unequal weight concentration.

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

ROOT CAUSE

Nominal record count ignores unequal weight concentration.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str(Fraction(sum(weights)**2,sum(w*w for w in weights))) if sum(w*w for w in weights) else None

Unsuccessful approach: The weight total is not squared, breaking scale invariance.

Case contract

Integer finite observations and equal lengths for paired samples. Counts and weights are nonnegative. Rational results use reduced Fraction strings. Empty or undefined statistics return None where shown. Effective sample size weights. Exact operational definition: str(Fraction(sum(weights)**2,sum(w*w for w in weights))) if sum(w*w for w in weights) else None

Why this case matters

Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Statistical estimators results depend on the stated convention.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(weights):
    return str(len(weights))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 1, 1],)', solve(*([1, 1, 1],)), '3')
check('fixture 2: ([1, 3],)', solve(*([1, 3],)), '8/5')
check('fixture 3: ([2, 2],)', solve(*([2, 2],)), '2')
check('fixture 4: ([0, 0],)', solve(*([0, 0],)), None)
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
fixture 1: ([1, 1, 1],)33Passed
fixture 2: ([1, 3],)28/5Failed
fixture 3: ([2, 2],)22Passed
fixture 4: ([0, 0],)2NoneFailed

SHA-256 / ffe91b435984864c251af15ec16f140fdc8afa777eb3a16b2d063e9650eaf6b8

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(weights):
    return str(Fraction(sum(weights),sum(w*w for w in weights))) if sum(w*w for w in weights) else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 1, 1],)', solve(*([1, 1, 1],)), '3')
check('fixture 2: ([1, 3],)', solve(*([1, 3],)), '8/5')
check('fixture 3: ([2, 2],)', solve(*([2, 2],)), '2')
check('fixture 4: ([0, 0],)', solve(*([0, 0],)), None)
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
fixture 1: ([1, 1, 1],)13Failed
fixture 2: ([1, 3],)2/58/5Failed
fixture 3: ([2, 2],)1/22Failed
fixture 4: ([0, 0],)NoneNonePassed

SHA-256 / 9cedc0ebc59ee3518e7c939ca3e59da5b8c66e630b69fbc563f6554ddb63d82b

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR

N = 1
observations = []
def solve(weights):
    return str(Fraction(sum(weights)**2,sum(w*w for w in weights))) if sum(w*w for w in weights) else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 1, 1],)', solve(*([1, 1, 1],)), '3')
check('fixture 2: ([1, 3],)', solve(*([1, 3],)), '8/5')
check('fixture 3: ([2, 2],)', solve(*([2, 2],)), '2')
check('fixture 4: ([0, 0],)', solve(*([0, 0],)), None)
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
fixture 1: ([1, 1, 1],)33Passed
fixture 2: ([1, 3],)8/58/5Passed
fixture 3: ([2, 2],)22Passed
fixture 4: ([0, 0],)NoneNonePassed

SHA-256 / de30c6de879983bcbbb14c751d3de89cc914495aa227febe9b8a437275b68548

Verification & scope

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:38:00.516582+00:00.

Case digest / 6e00bab65d2a3776d8c465e76f905f2b8a33fb8af54d67268f991280c540d2b8