FA-6296 / Statistics / Open access
Dice set similarity · case 01
The intersection is not doubled in Dice normalization.
ROOT CAUSE
The intersection is not doubled in Dice normalization.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str(Fraction(2*len(set(a)&set(b)),len(set(a))+len(set(b)))) if a or b else "1"
Unsuccessful approach: Jaccard union normalization implements a different overlap measure.
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. Duplicates do not affect either set. Two empty sets have similarity one; exactly one empty set has zero. Exact operational definition: str(Fraction(2*len(set(a)&set(b)),len(set(a))+len(set(b)))) if a or b else "1"
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(a, b):
return str(Fraction(len(set(a)&set(b)),len(set(a))+len(set(b)))) if a or b else "1"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2], [2, 3])', solve(*([1, 2], [2, 3])), '1/2')
check('fixture 2: ([1, 1], [1])', solve(*([1, 1], [1])), '1')
check('fixture 3: ([], [])', solve(*([], [])), '1')
check('fixture 4: ([1], [])', solve(*([1], [])), '0')
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], [2, 3]) | 1/4 | 1/2 | Failed |
| fixture 2: ([1, 1], [1]) | 1/2 | 1 | Failed |
| fixture 3: ([], []) | 1 | 1 | Passed |
| fixture 4: ([1], []) | 0 | 0 | Passed |
SHA-256 / be170451767060eebd82ab082e0e60663952cdef16c65191b891b38abab20b64
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(a, b):
return str(Fraction(len(set(a)&set(b)),len(set(a)|set(b)))) if a or b else "1"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2], [2, 3])', solve(*([1, 2], [2, 3])), '1/2')
check('fixture 2: ([1, 1], [1])', solve(*([1, 1], [1])), '1')
check('fixture 3: ([], [])', solve(*([], [])), '1')
check('fixture 4: ([1], [])', solve(*([1], [])), '0')
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], [2, 3]) | 1/3 | 1/2 | Failed |
| fixture 2: ([1, 1], [1]) | 1 | 1 | Passed |
| fixture 3: ([], []) | 1 | 1 | Passed |
| fixture 4: ([1], []) | 0 | 0 | Passed |
SHA-256 / 94171d1c1fe1f9bc737d3d973a888c258cc71b7876b0ee523855b6dbfcf17678
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(a, b):
return str(Fraction(2*len(set(a)&set(b)),len(set(a))+len(set(b)))) if a or b else "1"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 2], [2, 3])', solve(*([1, 2], [2, 3])), '1/2')
check('fixture 2: ([1, 1], [1])', solve(*([1, 1], [1])), '1')
check('fixture 3: ([], [])', solve(*([], [])), '1')
check('fixture 4: ([1], [])', solve(*([1], [])), '0')
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], [2, 3]) | 1/2 | 1/2 | Passed |
| fixture 2: ([1, 1], [1]) | 1 | 1 | Passed |
| fixture 3: ([], []) | 1 | 1 | Passed |
| fixture 4: ([1], []) | 0 | 0 | Passed |
SHA-256 / 9affd873bc6bef1dfbc574227d2d8fd98bce63925ba1435df2c7d4819d0a6036
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:37:59.962573+00:00.
Case digest / 081389b1ed3d8c469507c5c4d9214ccc0bb7bd14628a44b6fc28d6a89fe978f4