{"abstract":"Multiclass MCC reports accuracy instead of correlation.","category":"Evaluation metric aggregation","checks":7,"contract":"Return multiclass Matthews correlation coefficient for the supplied label set using the confusion-matrix formula; zero denominator yields 0.","contract_signature":"truth, pred, labels","evaluation_group":"w3-eval-multiclass-mcc","failed_approach":"Dividing the covariance numerator by squared sample count fails to normalize by class marginals.","family":"w3-evaluation-metric-aggregation-multiclass-mcc","id":"FA-100031","implementations":{"attempt":{"sha256":"05bda0f8cab95b8c9ec7b5db747837f347aaf456c0a41381f2fac08bede3e31b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(truth, pred, labels):\n    from math import sqrt\n    C=[[sum(a==i and b==j for a,b in zip(truth,pred)) for j in labels] for i in labels]; s=sum(map(sum,C)); c=sum(C[i][i] for i in range(len(labels))); r=[sum(row) for row in C]; q=[sum(C[i][j] for i in range(len(labels))) for j in range(len(labels))]; numerator=c*s-sum(x*y for x,y in zip(q,r)); return numerator/(s*s) if s else 0\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('binary perfect',solve([0,1],[0,1],[0,1]),1)\ncheck('binary inverse',solve([0,1],[1,0],[0,1]),-1)\ncheck('constant prediction',solve([0,1],[0,0],[0,1]),0)\ncheck('empty',solve([],[],[0,1]),0)\ncheck('three-class perfect',solve([0,1,2],[0,1,2],[0,1,2]),1)\ncheck('three-class cycle',solve([0,1,2],[1,2,0],[0,1,2]),-.5)\ncheck('unbalanced binary',solve([0,0,1,1,1],[0,1,1,1,1],[0,1]),3/(24**0.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":"33c6174dcd18aac3661d773b44decc8300e03179c08db4b298d51e0492ab5342","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(truth, pred, labels):\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('binary perfect',solve([0,1],[0,1],[0,1]),1)\ncheck('binary inverse',solve([0,1],[1,0],[0,1]),-1)\ncheck('constant prediction',solve([0,1],[0,0],[0,1]),0)\ncheck('empty',solve([],[],[0,1]),0)\ncheck('three-class perfect',solve([0,1,2],[0,1,2],[0,1,2]),1)\ncheck('three-class cycle',solve([0,1,2],[1,2,0],[0,1,2]),-.5)\ncheck('unbalanced binary',solve([0,0,1,1,1],[0,1,1,1,1],[0,1]),3/(24**0.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-multiclass-mcc","generated_at":"2026-09-30T16:48:30.810501+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 evaluator reports the diagonal fraction and loses the predicted and actual class marginals.","sha256":"648dfbfe1f6ab11672b973db01f105cc3d160c09663c28b0d56aa1c493af1320","title":"Multiclass MCC reports accuracy instead of correlation · 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":29.79,"exit_code":1,"observations":[{"actual":0.5,"check":"binary perfect","expected":1,"passed":false},{"actual":-0.5,"check":"binary inverse","expected":-1,"passed":false},{"actual":0.0,"check":"constant prediction","expected":0,"passed":true},{"actual":0,"check":"empty","expected":0,"passed":true},{"actual":0.6666666666666666,"check":"three-class perfect","expected":1,"passed":false},{"actual":-0.3333333333333333,"check":"three-class cycle","expected":-0.5,"passed":false},{"actual":0.24,"check":"unbalanced binary","expected":0.6123724356957946,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"binary perfect\", \"actual\": 0.5, \"expected\": 1, \"passed\": false}, {\"check\": \"binary inverse\", \"actual\": -0.5, \"expected\": -1, \"passed\": false}, {\"check\": \"constant prediction\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"three-class perfect\", \"actual\": 0.6666666666666666, \"expected\": 1, \"passed\": false}, {\"check\": \"three-class cycle\", \"actual\": -0.3333333333333333, \"expected\": -0.5, \"passed\": false}, {\"check\": \"unbalanced binary\", \"actual\": 0.24, \"expected\": 0.6123724356957946, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":26.194,"exit_code":1,"observations":[{"actual":1.0,"check":"binary perfect","expected":1,"passed":true},{"actual":0.0,"check":"binary inverse","expected":-1,"passed":false},{"actual":0.5,"check":"constant prediction","expected":0,"passed":false},{"actual":0,"check":"empty","expected":0,"passed":true},{"actual":1.0,"check":"three-class perfect","expected":1,"passed":true},{"actual":0.0,"check":"three-class cycle","expected":-0.5,"passed":false},{"actual":0.8,"check":"unbalanced binary","expected":0.6123724356957946,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"binary perfect\", \"actual\": 1.0, \"expected\": 1, \"passed\": true}, {\"check\": \"binary inverse\", \"actual\": 0.0, \"expected\": -1, \"passed\": false}, {\"check\": \"constant prediction\", \"actual\": 0.5, \"expected\": 0, \"passed\": false}, {\"check\": \"empty\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"three-class perfect\", \"actual\": 1.0, \"expected\": 1, \"passed\": true}, {\"check\": \"three-class cycle\", \"actual\": 0.0, \"expected\": -0.5, \"passed\": false}, {\"check\": \"unbalanced binary\", \"actual\": 0.8, \"expected\": 0.6123724356957946, \"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."}}