FAILURE MAP
← Case archive

FA-6316 / Statistics / Open access

Dense ranks with ties · case 01

Competition ranks leave gaps after tied groups.

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

ROOT CAUSE

Competition ranks leave gaps after tied groups.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return [sorted(set(values)).index(v)+1 for v in values]

Unsuccessful approach: Input positions ignore both sorting and ties.

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; tied values share a rank and the next distinct value increments by one. Exact operational definition: [sorted(set(values)).index(v)+1 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 [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],)), [3, 1, 1, 2])
check('fixture 2: ([1, 2],)', solve(*([1, 2],)), [1, 2])
check('fixture 3: ([5, 5],)', solve(*([5, 5],)), [1, 1])
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][3, 1, 1, 2]Failed
fixture 2: ([1, 2],)[1, 2][1, 2]Passed
fixture 3: ([5, 5],)[1, 1][1, 1]Passed
fixture 4: ([],)[][]Passed

SHA-256 / 3c52eb3d3089ffc5fdae854bb62be11fe8aff63325bc6cedbc9572d089c9ebbd

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 [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],)), [3, 1, 1, 2])
check('fixture 2: ([1, 2],)', solve(*([1, 2],)), [1, 2])
check('fixture 3: ([5, 5],)', solve(*([5, 5],)), [1, 1])
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][3, 1, 1, 2]Failed
fixture 2: ([1, 2],)[1, 2][1, 2]Passed
fixture 3: ([5, 5],)[1, 2][1, 1]Failed
fixture 4: ([],)[][]Passed

SHA-256 / 2ec2ec0855136bbfd9e6527e31520a3cd7b8f4de1af5a26fc8274c8c8425cd48

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 [sorted(set(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],)), [3, 1, 1, 2])
check('fixture 2: ([1, 2],)', solve(*([1, 2],)), [1, 2])
check('fixture 3: ([5, 5],)', solve(*([5, 5],)), [1, 1])
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],)[3, 1, 1, 2][3, 1, 1, 2]Passed
fixture 2: ([1, 2],)[1, 2][1, 2]Passed
fixture 3: ([5, 5],)[1, 1][1, 1]Passed
fixture 4: ([],)[][]Passed

SHA-256 / 499cb4f92ac1c9c41dc6fbab3c70b743295817d5cc5db31b889bd9cb7b300e2d

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

Case digest / 829d74031dc9df698d84b1ea20450707b9c5525b6660aafd4a7d6afc571f7890