FA-6216 / Statistics / Open access
Root mean square squared · case 01
Squaring the mean allows opposite-sign observations to cancel.
ROOT CAUSE
Squaring the mean allows opposite-sign observations to cancel.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return str(Fraction(sum(v*v for v in values),len(values))) if values else None
Unsuccessful approach: The sum of squares omits the mean normalization.
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. Root mean square squared. Exact operational definition: str(Fraction(sum(v*v for v in values),len(values))) if values 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(values):
return str(Fraction(sum(values),len(values))**2) if values else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([-3, 3],)', solve(*([-3, 3],)), '9')
check('fixture 2: ([1, 2, 3],)', solve(*([1, 2, 3],)), '14/3')
check('fixture 3: ([0],)', solve(*([0],)), '0')
check('fixture 4: ([],)', solve(*([],)), None)
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: ([-3, 3],) | 0 | 9 | Failed |
| fixture 2: ([1, 2, 3],) | 4 | 14/3 | Failed |
| fixture 3: ([0],) | 0 | 0 | Passed |
| fixture 4: ([],) | None | None | Passed |
SHA-256 / 464a2457f8773df41af55fb1ff7d285cb48e6d94c9814f584575b17825203f00
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(values):
return str(sum(v*v for v in values)) if values else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([-3, 3],)', solve(*([-3, 3],)), '9')
check('fixture 2: ([1, 2, 3],)', solve(*([1, 2, 3],)), '14/3')
check('fixture 3: ([0],)', solve(*([0],)), '0')
check('fixture 4: ([],)', solve(*([],)), None)
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: ([-3, 3],) | 18 | 9 | Failed |
| fixture 2: ([1, 2, 3],) | 14 | 14/3 | Failed |
| fixture 3: ([0],) | 0 | 0 | Passed |
| fixture 4: ([],) | None | None | Passed |
SHA-256 / d38eabf42d23ac1f815193e2b7c83a8bf89c195e2e69687eecffca1f71189173
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(values):
return str(Fraction(sum(v*v for v in values),len(values))) if values else None
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: ([-3, 3],)', solve(*([-3, 3],)), '9')
check('fixture 2: ([1, 2, 3],)', solve(*([1, 2, 3],)), '14/3')
check('fixture 3: ([0],)', solve(*([0],)), '0')
check('fixture 4: ([],)', solve(*([],)), None)
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: ([-3, 3],) | 9 | 9 | Passed |
| fixture 2: ([1, 2, 3],) | 14/3 | 14/3 | Passed |
| fixture 3: ([0],) | 0 | 0 | Passed |
| fixture 4: ([],) | None | None | Passed |
SHA-256 / aa7c8d44053744eacf8af52d3ef28810a766997211ad315cb05822c8dd4c47fb
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:58.872391+00:00.
Case digest / 73eb34d563b6ff37abe93f696a6f2af38bd9dc30a91a175e1f9973a4a2f0c513