{"abstract":"Balanced accuracy uses ordinary accuracy.","category":"Evaluation metric aggregation","checks":6,"contract":"Return the unweighted mean recall for labels 0 and 1; an absent class has recall 0.","contract_signature":"truth, pred","evaluation_group":"w3-eval-balanced-accuracy","failed_approach":"Adding a fixed count to each class recall changes perfect results for small samples.","family":"w3-evaluation-metric-aggregation-balanced-accuracy","id":"FA-99976","implementations":{"attempt":{"sha256":"656662b56951b06ffe8516d5f0f3953a3549709029a8298f53d8cd64ab98e700","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(truth, pred):\n    return sum((sum(a==k and b==k for a,b in zip(truth,pred))+1)/(sum(a==k for a in truth)+1) for k in (0,1))/2\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('rare class',solve([0]*N+[1],[0]*N+[0]),.5)\ncheck('perfect',solve([0,1],[0,1]),1)\ncheck('both wrong',solve([0,1],[1,0]),0)\ncheck('absent positive',solve([0]*N,[0]*N),.5)\ncheck('empty',solve([],[]),0)\ncheck('singleton positive hit',solve([1],[1]),.5)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"cee1d3ca5f0bdfd68ff121d591e40175012e98fc9c3219f20592f1781ee9e06e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(truth, pred):\n    return sum(a==b for a,b in zip(truth,pred))/len(truth) if truth else 0\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('rare class',solve([0]*N+[1],[0]*N+[0]),.5)\ncheck('perfect',solve([0,1],[0,1]),1)\ncheck('both wrong',solve([0,1],[1,0]),0)\ncheck('absent positive',solve([0]*N,[0]*N),.5)\ncheck('empty',solve([],[]),0)\ncheck('singleton positive hit',solve([1],[1]),.5)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"Inputs are finite toy labels and scores; this defines no benchmark protocol, production metric library, or model quality 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w3-evaluation-metric-aggregation-balanced-accuracy","generated_at":"2026-09-30T16:48:30.355536+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A small explicit evaluation contract makes aggregation behavior reproducible across labeled examples.","root_cause":"The per-class recalls are collapsed into a support-weighted global score.","sha256":"52f1897348f16fcfb161908a7740bdccf8dcdfb2f5dbf84625da62ffa09c62c3","title":"Balanced accuracy uses ordinary accuracy · case 01","variant":1,"variant_policy":"The fixture code references N, supplied as 1 through 5. Fixed boundary checks may repeat. These records share one mechanism and must remain together in evaluation splits.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":29.993,"exit_code":1,"observations":[{"actual":0.75,"check":"rare class","expected":0.5,"passed":false},{"actual":1.0,"check":"perfect","expected":1,"passed":true},{"actual":0.5,"check":"both wrong","expected":0,"passed":false},{"actual":1.0,"check":"absent positive","expected":0.5,"passed":false},{"actual":1.0,"check":"empty","expected":0,"passed":false},{"actual":1.0,"check":"singleton positive hit","expected":0.5,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"rare class\", \"actual\": 0.75, \"expected\": 0.5, \"passed\": false}, {\"check\": \"perfect\", \"actual\": 1.0, \"expected\": 1, \"passed\": true}, {\"check\": \"both wrong\", \"actual\": 0.5, \"expected\": 0, \"passed\": false}, {\"check\": \"absent positive\", \"actual\": 1.0, \"expected\": 0.5, \"passed\": false}, {\"check\": \"empty\", \"actual\": 1.0, \"expected\": 0, \"passed\": false}, {\"check\": \"singleton positive hit\", \"actual\": 1.0, \"expected\": 0.5, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":27.954,"exit_code":1,"observations":[{"actual":0.5,"check":"rare class","expected":0.5,"passed":true},{"actual":1.0,"check":"perfect","expected":1,"passed":true},{"actual":0.0,"check":"both wrong","expected":0,"passed":true},{"actual":1.0,"check":"absent positive","expected":0.5,"passed":false},{"actual":0,"check":"empty","expected":0,"passed":true},{"actual":1.0,"check":"singleton positive hit","expected":0.5,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"rare class\", \"actual\": 0.5, \"expected\": 0.5, \"passed\": true}, {\"check\": \"perfect\", \"actual\": 1.0, \"expected\": 1, \"passed\": true}, {\"check\": \"both wrong\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"absent positive\", \"actual\": 1.0, \"expected\": 0.5, \"passed\": false}, {\"check\": \"empty\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"singleton positive hit\", \"actual\": 1.0, \"expected\": 0.5, \"passed\": false}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}