{"abstract":"Macro F1 averages pooled counts instead of class scores.","category":"Evaluation metric aggregation","checks":7,"contract":"For each supplied label calculate 2TP/(2TP+FP+FN), using zero for a zero denominator, then average labels; empty labels returns 0.","contract_signature":"truth, pred, labels","evaluation_group":"w3-eval-macro-f1","failed_approach":"Adding an absent label to the macro denominator dilutes otherwise valid class scores.","family":"w3-evaluation-metric-aggregation-macro-f1","id":"FA-99966","implementations":{"attempt":{"sha256":"ff8d36ff4ee7034136c165ec7377d5088dc8b8ea1104d55b9886e1fe7ce473ec","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(truth, pred, labels):\n    scores=[]\n    for k in labels:\n        tp=sum(a==k and b==k for a,b in zip(truth,pred)); fp=sum(a!=k and b==k for a,b in zip(truth,pred)); fn=sum(a==k and b!=k for a,b in zip(truth,pred)); den=2*tp+fp+fn\n        scores.append(2*tp/den if den else 0)\n    return sum(scores)/len(labels+[99]) if labels else 0\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('imbalance',solve([0,0,0,1],[0,1,1,1],[0,1]),.5)\ncheck('pooled differs',solve([0,0,0,0,1],[0,0,0,1,0],[0,1]),.375)\ncheck('perfect',solve([0,1],[0,1],[0,1]),1)\ncheck('all wrong',solve([0,1],[1,0],[0,1]),0)\ncheck('empty labels',solve([0],[0],[]),0)\ncheck('empty data',solve([],[],[0,1]),0)\ncheck('only absent label',solve([1],[1],[2]),0)\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":"87a6d7ef8483310761f1c6e6814b72d86ba6613ab8dc17ede1fecce5678fce41","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(truth, pred, labels):\n    tp=sum(a==b and a in labels for a,b in zip(truth,pred)); fp=sum(b in labels and a!=b for a,b in zip(truth,pred)); fn=sum(a in labels and a!=b for a,b in zip(truth,pred)); return 2*tp/(2*tp+fp+fn) if 2*tp+fp+fn else 0\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('imbalance',solve([0,0,0,1],[0,1,1,1],[0,1]),.5)\ncheck('pooled differs',solve([0,0,0,0,1],[0,0,0,1,0],[0,1]),.375)\ncheck('perfect',solve([0,1],[0,1],[0,1]),1)\ncheck('all wrong',solve([0,1],[1,0],[0,1]),0)\ncheck('empty labels',solve([0],[0],[]),0)\ncheck('empty data',solve([],[],[0,1]),0)\ncheck('only absent label',solve([1],[1],[2]),0)\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-macro-f1","generated_at":"2026-09-30T16:48:30.355729+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":"Counts are pooled before the harmonic mean, hiding per-class imbalance.","sha256":"81288f8a537a0548a6c493dc257b3dc81654a80d370098659f0f0154b37b016f","title":"Macro F1 averages pooled counts instead of class scores · case 01","variant":1,"variant_policy":"The same explicitly authored fixtures repeat across all five numbered records; runtime N is unused. These records share one mechanism and must remain together in evaluation splits.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":30.327,"exit_code":1,"observations":[{"actual":0.3333333333333333,"check":"imbalance","expected":0.5,"passed":false},{"actual":0.25,"check":"pooled differs","expected":0.375,"passed":false},{"actual":0.6666666666666666,"check":"perfect","expected":1,"passed":false},{"actual":0.0,"check":"all wrong","expected":0,"passed":true},{"actual":0,"check":"empty labels","expected":0,"passed":true},{"actual":0.0,"check":"empty data","expected":0,"passed":true},{"actual":0.0,"check":"only absent label","expected":0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"imbalance\", \"actual\": 0.3333333333333333, \"expected\": 0.5, \"passed\": false}, {\"check\": \"pooled differs\", \"actual\": 0.25, \"expected\": 0.375, \"passed\": false}, {\"check\": \"perfect\", \"actual\": 0.6666666666666666, \"expected\": 1, \"passed\": false}, {\"check\": \"all wrong\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty labels\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty data\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"only absent label\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":28.274,"exit_code":1,"observations":[{"actual":0.5,"check":"imbalance","expected":0.5,"passed":true},{"actual":0.6,"check":"pooled differs","expected":0.375,"passed":false},{"actual":1.0,"check":"perfect","expected":1,"passed":true},{"actual":0.0,"check":"all wrong","expected":0,"passed":true},{"actual":0,"check":"empty labels","expected":0,"passed":true},{"actual":0,"check":"empty data","expected":0,"passed":true},{"actual":0,"check":"only absent label","expected":0,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"imbalance\", \"actual\": 0.5, \"expected\": 0.5, \"passed\": true}, {\"check\": \"pooled differs\", \"actual\": 0.6, \"expected\": 0.375, \"passed\": false}, {\"check\": \"perfect\", \"actual\": 1.0, \"expected\": 1, \"passed\": true}, {\"check\": \"all wrong\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty labels\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty data\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"only absent label\", \"actual\": 0, \"expected\": 0, \"passed\": true}], \"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."}}