FA-13771 / Numerical aggregation / Open access
Adjusted partition pair agreement: Chance agreement uses a sum of marginal pair totals. · case 01
The reduction disagrees with its explicit aggregation oracle.
ROOT CAUSE
Chance agreement uses a sum of marginal pair totals.
VERIFIED REPAIR
Preserve the adjusted partition pair agreement contract at the identified reduction decision.
Unsuccessful approach: Normalizing by pair count twice turns expected pair count into a probability.
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 1 | 1 | 1 | Passed |
| regression 2 | -1/2 | -1/2 | Passed |
| regression 3 | 1 | 1 | Passed |
| regression 4 | 1 | 1 | Passed |
| regression 5 | 3/28 | -2/23 | Failed |
| regression 6 | 1 | 1 | Passed |
| regression 7 | None | None | Passed |
| regression 8 | 68/143 | 34/109 | Failed |
| variable label names | 1 | 1 | Passed |
SHA-256 / d70d0fe2c31e80172ab13e4b9e95ce8bab16fde71b80407c60b199e3081f0567
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(x*y,pairs*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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 1 | 1 | 1 | Passed |
| regression 2 | -1/17 | -1/2 | Failed |
| regression 3 | 1 | 1 | Passed |
| regression 4 | 1 | 1 | Passed |
| regression 5 | 44/169 | -2/23 | Failed |
| regression 6 | 1 | 1 | Passed |
| regression 7 | None | None | Passed |
| regression 8 | 1294/2419 | 34/109 | Failed |
| variable label names | 1 | 1 | Passed |
SHA-256 / 123877e1265f94054ae45f5c270058e1908292b5a4cb8a0ceae79f7d29aa3d9b
3 / The verified repair
Exit 0"""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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 1 | 1 | 1 | Passed |
| regression 2 | -1/2 | -1/2 | Passed |
| regression 3 | 1 | 1 | Passed |
| regression 4 | 1 | 1 | Passed |
| regression 5 | -2/23 | -2/23 | Passed |
| regression 6 | 1 | 1 | Passed |
| regression 7 | None | None | Passed |
| regression 8 | 34/109 | 34/109 | Passed |
| variable label names | 1 | 1 | Passed |
SHA-256 / f1d717731848ae1508be0aed6706e7ae4b085082a44842998adbcafe1bc5ec7c
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.358449+00:00.
Case digest / b39361de66f89570925a28840a8dc361e61e8102b51fbc187f902dbdaf2a48b1