FA-6261 / Statistics / Open access
Mean absolute error · case 01
Opposite errors cancel before absolute value is applied.
ROOT CAUSE
Opposite errors cancel before absolute value is applied.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str(Fraction(sum(abs(a-p) for a,p in zip(actual,predicted)),len(actual)))
Unsuccessful approach: Squared error changes the loss function.
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. Paired arrays are nonempty; average absolute prediction residuals. Exact operational definition: str(Fraction(sum(abs(a-p) for a,p in zip(actual,predicted)),len(actual)))
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(actual, predicted):
return str(abs(Fraction(sum(a-p for a,p in zip(actual,predicted)),len(actual))))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 3], [2, 2])', solve(*([1, 3], [2, 2])), '1')
check('fixture 2: ([0, 0], [2, -2])', solve(*([0, 0], [2, -2])), '2')
check('fixture 3: ([1], [1])', solve(*([1], [1])), '0')
check('fixture 4: ([1, 2, 3], [1, 2, 6])', solve(*([1, 2, 3], [1, 2, 6])), '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 |
|---|---|---|---|
| fixture 1: ([1, 3], [2, 2]) | 0 | 1 | Failed |
| fixture 2: ([0, 0], [2, -2]) | 0 | 2 | Failed |
| fixture 3: ([1], [1]) | 0 | 0 | Passed |
| fixture 4: ([1, 2, 3], [1, 2, 6]) | 1 | 1 | Passed |
SHA-256 / e83d452320eba9e0a810be3236686a01b371ac709c374aa69d173e24559ca3b4
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(actual, predicted):
return str(Fraction(sum((a-p)**2 for a,p in zip(actual,predicted)),len(actual)))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 3], [2, 2])', solve(*([1, 3], [2, 2])), '1')
check('fixture 2: ([0, 0], [2, -2])', solve(*([0, 0], [2, -2])), '2')
check('fixture 3: ([1], [1])', solve(*([1], [1])), '0')
check('fixture 4: ([1, 2, 3], [1, 2, 6])', solve(*([1, 2, 3], [1, 2, 6])), '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 |
|---|---|---|---|
| fixture 1: ([1, 3], [2, 2]) | 1 | 1 | Passed |
| fixture 2: ([0, 0], [2, -2]) | 4 | 2 | Failed |
| fixture 3: ([1], [1]) | 0 | 0 | Passed |
| fixture 4: ([1, 2, 3], [1, 2, 6]) | 3 | 1 | Failed |
SHA-256 / fdb76c95cb8a76742855a980dd82aa9c93daa5d8daf7b9bb0f1301a1af452afd
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(actual, predicted):
return str(Fraction(sum(abs(a-p) for a,p in zip(actual,predicted)),len(actual)))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([1, 3], [2, 2])', solve(*([1, 3], [2, 2])), '1')
check('fixture 2: ([0, 0], [2, -2])', solve(*([0, 0], [2, -2])), '2')
check('fixture 3: ([1], [1])', solve(*([1], [1])), '0')
check('fixture 4: ([1, 2, 3], [1, 2, 6])', solve(*([1, 2, 3], [1, 2, 6])), '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 |
|---|---|---|---|
| fixture 1: ([1, 3], [2, 2]) | 1 | 1 | Passed |
| fixture 2: ([0, 0], [2, -2]) | 2 | 2 | Passed |
| fixture 3: ([1], [1]) | 0 | 0 | Passed |
| fixture 4: ([1, 2, 3], [1, 2, 6]) | 1 | 1 | Passed |
SHA-256 / e2c709ab4022d95f80e019e03340f4d9006c9ed0e14e782b05b560f9bea9f552
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.555715+00:00.
Case digest / 348c8f16899bf50ee877e39b8622f01d2624d2e6e30d779b0209500e1f83b2de