FAILURE MAP
← Case archive

FA-6276 / Statistics / Open access

Binary recall rational · case 01

Predicted positives replace actual positives.

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

ROOT CAUSE

Predicted positives replace actual positives.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str(Fraction(tp,tp+fn)) if tp+fn else None

Unsuccessful approach: Only errors are used as denominator.

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. tp,fp,fn are nonnegative counts; undefined zero-denominator recall returns None. Exact operational definition: str(Fraction(tp,tp+fn)) if tp+fn else None

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(tp, fp, fn):
    return str(Fraction(tp,tp+fp)) if tp+fp else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 1, 2)', solve(*(3, 1, 2)), '3/5')
check('fixture 2: (0, 2, 1)', solve(*(0, 2, 1)), '0')
check('fixture 3: (0, 2, 0)', solve(*(0, 2, 0)), None)
check('fixture 4: (5, 1, 0)', solve(*(5, 1, 0)), '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
fixture 1: (3, 1, 2)3/43/5Failed
fixture 2: (0, 2, 1)00Passed
fixture 3: (0, 2, 0)0NoneFailed
fixture 4: (5, 1, 0)5/61Failed

SHA-256 / 46c476b5cc7cb7cda8360ca7ec8458219afdc172836c2c7afa2d36684251bf4d

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(tp, fp, fn):
    return str(Fraction(tp,fp+fn)) if fp+fn else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 1, 2)', solve(*(3, 1, 2)), '3/5')
check('fixture 2: (0, 2, 1)', solve(*(0, 2, 1)), '0')
check('fixture 3: (0, 2, 0)', solve(*(0, 2, 0)), None)
check('fixture 4: (5, 1, 0)', solve(*(5, 1, 0)), '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
fixture 1: (3, 1, 2)13/5Failed
fixture 2: (0, 2, 1)00Passed
fixture 3: (0, 2, 0)0NoneFailed
fixture 4: (5, 1, 0)51Failed

SHA-256 / ba60e1558ee9ed37486bcb98df5200917612c29692e3e1feec1a6d23bc8770a5

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(tp, fp, fn):
    return str(Fraction(tp,tp+fn)) if tp+fn else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (3, 1, 2)', solve(*(3, 1, 2)), '3/5')
check('fixture 2: (0, 2, 1)', solve(*(0, 2, 1)), '0')
check('fixture 3: (0, 2, 0)', solve(*(0, 2, 0)), None)
check('fixture 4: (5, 1, 0)', solve(*(5, 1, 0)), '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
fixture 1: (3, 1, 2)3/53/5Passed
fixture 2: (0, 2, 1)00Passed
fixture 3: (0, 2, 0)NoneNonePassed
fixture 4: (5, 1, 0)11Passed

SHA-256 / 983cc8d7da91625ba439b6dcfc1400b766a7928981a58df5b19627aea7d4655f

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

Case digest / 482b93612629f91d15e718557afa32d6a09333df8d5e2148c97764a6d2592958