FAILURE MAP
← Case archive

FA-6311 / Statistics / Open access

Average ranks with ties · case 01

Each tied group receives its first rank rather than average rank.

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

ROOT CAUSE

Each tied group receives its first rank rather than average rank.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return [str(Fraction(sum(i+1 for i,x in enumerate(sorted(values)) if x==v),values.count(v))) for v in values]

Unsuccessful approach: Arrival order is ranked instead of observation magnitude.

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. Ascending ranks start at one and ties receive the mean occupied rank as a Fraction string; preserve original order. Exact operational definition: [str(Fraction(sum(i+1 for i,x in enumerate(sorted(values)) if x==v),values.count(v))) for v in values]

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(sorted(values).index(v)+1) for v in values]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([30, 10, 10, 20],)', solve(*([30, 10, 10, 20],)), ['4', '3/2', '3/2', '3'])
check('fixture 2: ([1, 2],)', solve(*([1, 2],)), ['1', '2'])
check('fixture 3: ([5, 5],)', solve(*([5, 5],)), ['3/2', '3/2'])
check('fixture 4: ([],)', solve(*([],)), [])
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: ([30, 10, 10, 20],)['4', '1', '1', '3']['4', '3/2', '3/2', '3']Failed
fixture 2: ([1, 2],)['1', '2']['1', '2']Passed
fixture 3: ([5, 5],)['1', '1']['3/2', '3/2']Failed
fixture 4: ([],)[][]Passed

SHA-256 / 4c5c6ed3b65e0705efe3e6b0dd5f3835cce16cd94803a7941ae755a6c15a189a

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(i+1) for i in range(len(values))]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([30, 10, 10, 20],)', solve(*([30, 10, 10, 20],)), ['4', '3/2', '3/2', '3'])
check('fixture 2: ([1, 2],)', solve(*([1, 2],)), ['1', '2'])
check('fixture 3: ([5, 5],)', solve(*([5, 5],)), ['3/2', '3/2'])
check('fixture 4: ([],)', solve(*([],)), [])
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: ([30, 10, 10, 20],)['1', '2', '3', '4']['4', '3/2', '3/2', '3']Failed
fixture 2: ([1, 2],)['1', '2']['1', '2']Passed
fixture 3: ([5, 5],)['1', '2']['3/2', '3/2']Failed
fixture 4: ([],)[][]Passed

SHA-256 / 9450bb4cc6cf1dc2388c2c64421b663b3630c135c9a8147ad925aaa22b83ff78

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(i+1 for i,x in enumerate(sorted(values)) if x==v),values.count(v))) for v in values]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([30, 10, 10, 20],)', solve(*([30, 10, 10, 20],)), ['4', '3/2', '3/2', '3'])
check('fixture 2: ([1, 2],)', solve(*([1, 2],)), ['1', '2'])
check('fixture 3: ([5, 5],)', solve(*([5, 5],)), ['3/2', '3/2'])
check('fixture 4: ([],)', solve(*([],)), [])
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: ([30, 10, 10, 20],)['4', '3/2', '3/2', '3']['4', '3/2', '3/2', '3']Passed
fixture 2: ([1, 2],)['1', '2']['1', '2']Passed
fixture 3: ([5, 5],)['3/2', '3/2']['3/2', '3/2']Passed
fixture 4: ([],)[][]Passed

SHA-256 / 2cbeb7256ce827d1d6cf53c701f5e1193e4d3c5f12c92f7b1fa0cc81d9fdbd52

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

Case digest / 0a94c5761bac7df4e50f81cf4898cc2fd5b4f0d164d28546c9647763e7fe67ae