{"abstract":"Sample weights are applied only to correct rows.","category":"Evaluation metric aggregation","checks":6,"contract":"Return weighted accuracy for aligned labels and nonnegative weights; zero total weight yields 0.","contract_signature":"truth, pred, weights","evaluation_group":"w3-eval-sample-weighted-accuracy","failed_approach":"Using only correct-row weights in the denominator forces every nonzero score to one.","family":"w3-evaluation-metric-aggregation-sample-weighted-accuracy","id":"FA-100011","implementations":{"attempt":{"sha256":"7f29e08cbe2e1219e96704645489db1135b1df6e053ad8aeeeaeedced82901b5","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(truth, pred, weights):\n    total=sum(weights); correct=sum(w for a,b,w in zip(truth,pred,weights) if a==b); return correct/(correct or 1) if total else 0\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('unequal weights',solve([1,0],[1,1],[N,1]),N/(N+1))\ncheck('all right',solve([1,0],[1,0],[2,3]),1)\ncheck('all wrong',solve([1],[0],[N]),0)\ncheck('zero weights',solve([1],[1],[0]),0)\ncheck('empty',solve([],[],[]),0)\ncheck('weighted miss dominates',solve([1,0],[0,0],[N,1]),1/(N+1))\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":"89143b0ba799e63f0e4dbdb3ca1f0be0f3d64f74022880b5c035e44a09dff95a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(truth, pred, weights):\n    return sum(w for a,b,w in zip(truth,pred,weights) if a==b)/len(truth) if truth else 0\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('unequal weights',solve([1,0],[1,1],[N,1]),N/(N+1))\ncheck('all right',solve([1,0],[1,0],[2,3]),1)\ncheck('all wrong',solve([1],[0],[N]),0)\ncheck('zero weights',solve([1],[1],[0]),0)\ncheck('empty',solve([],[],[]),0)\ncheck('weighted miss dominates',solve([1,0],[0,0],[N,1]),1/(N+1))\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-sample-weighted-accuracy","generated_at":"2026-09-30T16:48:30.810521+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":"Weighted correctness is normalized by row count rather than total sample weight.","sha256":"6a1ac2e61f8ddf3187d1bf1d053b2c61bb19670e545e2805b0b293c52627c5de","title":"Sample weights are applied only to correct rows · 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":30.634,"exit_code":1,"observations":[{"actual":1.0,"check":"unequal weights","expected":0.5,"passed":false},{"actual":1.0,"check":"all right","expected":1,"passed":true},{"actual":0.0,"check":"all wrong","expected":0,"passed":true},{"actual":0,"check":"zero weights","expected":0,"passed":true},{"actual":0,"check":"empty","expected":0,"passed":true},{"actual":1.0,"check":"weighted miss dominates","expected":0.5,"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal weights\", \"actual\": 1.0, \"expected\": 0.5, \"passed\": false}, {\"check\": \"all right\", \"actual\": 1.0, \"expected\": 1, \"passed\": true}, {\"check\": \"all wrong\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"zero weights\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"weighted miss dominates\", \"actual\": 1.0, \"expected\": 0.5, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":27.511,"exit_code":1,"observations":[{"actual":0.5,"check":"unequal weights","expected":0.5,"passed":true},{"actual":2.5,"check":"all right","expected":1,"passed":false},{"actual":0.0,"check":"all wrong","expected":0,"passed":true},{"actual":0.0,"check":"zero weights","expected":0,"passed":true},{"actual":0,"check":"empty","expected":0,"passed":true},{"actual":0.5,"check":"weighted miss dominates","expected":0.5,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal weights\", \"actual\": 0.5, \"expected\": 0.5, \"passed\": true}, {\"check\": \"all right\", \"actual\": 2.5, \"expected\": 1, \"passed\": false}, {\"check\": \"all wrong\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"zero weights\", \"actual\": 0.0, \"expected\": 0, \"passed\": true}, {\"check\": \"empty\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"weighted miss dominates\", \"actual\": 0.5, \"expected\": 0.5, \"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."}}