FA-6326 / Statistics / Open access
Gini mean difference rational · case 01
The sample range replaces average pairwise distance.
ROOT CAUSE
The sample range replaces average pairwise distance.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str(Fraction(sum(abs(a-b) for a in values for b in values),len(values)**2)) if values else None
Unsuccessful approach: Normalization uses observations rather than ordered observation pairs.
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. Gini mean difference rational. Exact operational definition: str(Fraction(sum(abs(a-b) for a in values for b in values),len(values)**2)) if values 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(values):
return str(Fraction(max(values)-min(values),1)) if values else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3],)', solve(*([1, 2, 3],)), '8/9')
check('fixture 2: ([5, 5],)', solve(*([5, 5],)), '0')
check('fixture 3: ([0, 4],)', solve(*([0, 4],)), '2')
check('fixture 4: ([],)', solve(*([],)), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: ([1, 2, 3],) | 2 | 8/9 | Failed |
| fixture 2: ([5, 5],) | 0 | 0 | Passed |
| fixture 3: ([0, 4],) | 4 | 2 | Failed |
| fixture 4: ([],) | None | None | Passed |
SHA-256 / 0f2adf0123ed81f8cac80b5a6e0e3ad31b5b0da5fcdeba7925c0019a312b2bf5
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(values):
return str(Fraction(sum(abs(a-b) for a in values for b in values),len(values))) if values else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3],)', solve(*([1, 2, 3],)), '8/9')
check('fixture 2: ([5, 5],)', solve(*([5, 5],)), '0')
check('fixture 3: ([0, 4],)', solve(*([0, 4],)), '2')
check('fixture 4: ([],)', solve(*([],)), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: ([1, 2, 3],) | 8/3 | 8/9 | Failed |
| fixture 2: ([5, 5],) | 0 | 0 | Passed |
| fixture 3: ([0, 4],) | 4 | 2 | Failed |
| fixture 4: ([],) | None | None | Passed |
SHA-256 / 3be81af47962cf8541d7e073c26f5d5476ee5b1b137ff958fde9c0389e56b1a2
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(values):
return str(Fraction(sum(abs(a-b) for a in values for b in values),len(values)**2)) if values else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2, 3],)', solve(*([1, 2, 3],)), '8/9')
check('fixture 2: ([5, 5],)', solve(*([5, 5],)), '0')
check('fixture 3: ([0, 4],)', solve(*([0, 4],)), '2')
check('fixture 4: ([],)', solve(*([],)), 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| fixture 1: ([1, 2, 3],) | 8/9 | 8/9 | Passed |
| fixture 2: ([5, 5],) | 0 | 0 | Passed |
| fixture 3: ([0, 4],) | 2 | 2 | Passed |
| fixture 4: ([],) | None | None | Passed |
SHA-256 / be6b51472e0b7952038185119335d9ad0d1ad569bdd46ede5ec68a58edd34af0
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.488757+00:00.
Case digest / 0daee6d8ca881e44767daca499a3fc6b027b76ae363a24966b667e07dd559368