FAILURE MAP
← Case archive

FA-13806 / Numerical aggregation / Open access

Adjusted partition pair agreement: Expected pair agreement is truncated before adjustment. · case 01

The reduction disagrees with its explicit aggregation oracle.

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

ROOT CAUSE

Expected pair agreement is truncated before adjustment.

THE FAILURE

Expected pair agreement is truncated before adjustment.

Unsuccessful approach: Rounding expected agreement also destroys exact chance correction.

Case contract

Two equal-length integer cluster label arrays describe the same observations. Return exact adjusted Rand index from pair-count contingency reduction. Label names have no numerical meaning. Matching degenerate partitions with zero normalization return "1"; length mismatch returns None.

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(a, b):
    if len(a)!=len(b): return None
    n=len(a)
    if n<2: return "1"
    pairs=n*(n-1)//2
    joint=Counter(zip(a,b))
    ra,rb=Counter(a),Counter(b)
    choose=lambda k:k*(k-1)//2
    same=sum(choose(v) for v in joint.values())
    x=sum(choose(v) for v in ra.values())
    y=sum(choose(v) for v in rb.values())
    expected=Fraction(x*y//pairs)
    ceiling=Fraction(x+y,2)
    return "1" if ceiling==expected else str((same-expected)/(ceiling-expected))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([0, 0, 1, 1], [4, 4, 5, 5])), '1')
check('regression 2', solve(*([0, 0, 1, 1], [0, 1, 0, 1])), '-1/2')
check('regression 3', solve(*([], [])), '1')
check('regression 4', solve(*([0], [9])), '1')
check('regression 5', solve(*([0, 0, 0, 1, 2], [1, 1, 2, 2, 2])), '-2/23')
check('regression 6', solve(*([0, 1, 2], [8, 9, 10])), '1')
check('regression 7', solve(*([0, 0], [1])), None)
check('regression 8', solve(*([0, 0, 1, 2, 2, 2], [4, 5, 4, 5, 5, 5])), '34/109')
check("variable label names",solve([N,N,N+1,N+1],[7,7,8,8]),"1")
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 111Passed
regression 20-1/2Failed
regression 311Passed
regression 411Passed
regression 50-2/23Failed
regression 611Passed
regression 7NoneNonePassed
regression 84/934/109Failed
variable label names11Passed

SHA-256 / 4c5842fc3ebed4ff99cdf7ed0f6c37b72886fcd5729409b4571472dedc365814

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(a, b):
    if len(a)!=len(b): return None
    n=len(a)
    if n<2: return "1"
    pairs=n*(n-1)//2
    joint=Counter(zip(a,b))
    ra,rb=Counter(a),Counter(b)
    choose=lambda k:k*(k-1)//2
    same=sum(choose(v) for v in joint.values())
    x=sum(choose(v) for v in ra.values())
    y=sum(choose(v) for v in rb.values())
    expected=Fraction(round(Fraction(x*y,pairs)))
    ceiling=Fraction(x+y,2)
    return "1" if ceiling==expected else str((same-expected)/(ceiling-expected))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('regression 1', solve(*([0, 0, 1, 1], [4, 4, 5, 5])), '1')
check('regression 2', solve(*([0, 0, 1, 1], [0, 1, 0, 1])), '-1/2')
check('regression 3', solve(*([], [])), '1')
check('regression 4', solve(*([0], [9])), '1')
check('regression 5', solve(*([0, 0, 0, 1, 2], [1, 1, 2, 2, 2])), '-2/23')
check('regression 6', solve(*([0, 1, 2], [8, 9, 10])), '1')
check('regression 7', solve(*([0, 0], [1])), None)
check('regression 8', solve(*([0, 0, 1, 2, 2, 2], [4, 5, 4, 5, 5, 5])), '34/109')
check("variable label names",solve([N,N,N+1,N+1],[7,7,8,8]),"1")
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 111Passed
regression 2-1-1/2Failed
regression 311Passed
regression 411Passed
regression 50-2/23Failed
regression 611Passed
regression 7NoneNonePassed
regression 82/734/109Failed
variable label names11Passed

SHA-256 / c37101d0def12e3bab68db6fcca5fa70db6708806885f99bafe5335d75d4d0bc

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

Case digest / d44471d40d256a501611aff50b8b1f772e83e362677dc8e1fee76957675d5ad5