{"abstract":"Class weights are emitted in class order instead of example order.","category":"Training label alignment","checks":7,"contract":"Return one weight per label from the supplied class-to-weight mapping; unknown labels use the supplied default.","contract_signature":"labels, weights, default","evaluation_group":"training-label-alignment-per-label-weight-lookup","failed_approach":"Sorting examples before lookup returns valid weights in the wrong row order.","family":"w3-training-label-alignment-class-weight-lookup","id":"FA-97971","implementations":{"attempt":{"sha256":"1899d3466d306d6a221a47a56dbdb75fdd16782a43abe6bb246b5431ed432fc3","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(labels, weights, default):\n    return [weights.get(k,default) for k in sorted(labels)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('input order retained',solve(['z','a'],{'z':N,'a':N+1},7),[N,N+1])\ncheck('unknown default',solve(['q'],{'a':1},N),[N])\ncheck('empty labels',solve([],{ 'a':N},0),[])\ncheck('zero weight',solve(['x'],{'x':0},9),[0])\ncheck('repeated class',solve(['b','a','b'],{'a':N,'b':N+1},0),[N+1,N,N+1])\ncheck('all unknown',solve(['u','v'],{},N),[N,N])\ncheck('single known',solve(['a'],{'a':N},0),[N])\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":"2b346492692ab827f8e18b586aa3dd9d7d06a3b9c9262da4a398e3a0f87ffaac","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(labels, weights, default):\n    return [weights[k] for k in sorted(weights) if k in labels]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('input order retained',solve(['z','a'],{'z':N,'a':N+1},7),[N,N+1])\ncheck('unknown default',solve(['q'],{'a':1},N),[N])\ncheck('empty labels',solve([],{ 'a':N},0),[])\ncheck('zero weight',solve(['x'],{'x':0},9),[0])\ncheck('repeated class',solve(['b','a','b'],{'a':N,'b':N+1},0),[N+1,N,N+1])\ncheck('all unknown',solve(['u','v'],{},N),[N,N])\ncheck('single known',solve(['a'],{'a':N},0),[N])\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":"Class keys are unique dictionary keys; weights are finite scalars. 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-training-label-alignment-class-weight-lookup","generated_at":"2026-09-30T16:48:07.975749+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A small deterministic training-data operation makes label ownership and ordering explicit.","root_cause":"The routine enumerates class weights rather than looking up one weight for each example in sequence.","sha256":"027c015e20f238983f24f2b413c4634b1abd01dbf32a1a0313bf05aae5fea337","title":"Class weights are emitted in class order instead of example order · 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":26.2,"exit_code":1,"observations":[{"actual":[2,1],"check":"input order retained","expected":[1,2],"passed":false},{"actual":[1],"check":"unknown default","expected":[1],"passed":true},{"actual":[],"check":"empty labels","expected":[],"passed":true},{"actual":[0],"check":"zero weight","expected":[0],"passed":true},{"actual":[1,2,2],"check":"repeated class","expected":[2,1,2],"passed":false},{"actual":[1,1],"check":"all unknown","expected":[1,1],"passed":true},{"actual":[1],"check":"single known","expected":[1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"input order retained\", \"actual\": [2, 1], \"expected\": [1, 2], \"passed\": false}, {\"check\": \"unknown default\", \"actual\": [1], \"expected\": [1], \"passed\": true}, {\"check\": \"empty labels\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"zero weight\", \"actual\": [0], \"expected\": [0], \"passed\": true}, {\"check\": \"repeated class\", \"actual\": [1, 2, 2], \"expected\": [2, 1, 2], \"passed\": false}, {\"check\": \"all unknown\", \"actual\": [1, 1], \"expected\": [1, 1], \"passed\": true}, {\"check\": \"single known\", \"actual\": [1], \"expected\": [1], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":26.434,"exit_code":1,"observations":[{"actual":[2,1],"check":"input order retained","expected":[1,2],"passed":false},{"actual":[],"check":"unknown default","expected":[1],"passed":false},{"actual":[],"check":"empty labels","expected":[],"passed":true},{"actual":[0],"check":"zero weight","expected":[0],"passed":true},{"actual":[1,2],"check":"repeated class","expected":[2,1,2],"passed":false},{"actual":[],"check":"all unknown","expected":[1,1],"passed":false},{"actual":[1],"check":"single known","expected":[1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"input order retained\", \"actual\": [2, 1], \"expected\": [1, 2], \"passed\": false}, {\"check\": \"unknown default\", \"actual\": [], \"expected\": [1], \"passed\": false}, {\"check\": \"empty labels\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"zero weight\", \"actual\": [0], \"expected\": [0], \"passed\": true}, {\"check\": \"repeated class\", \"actual\": [1, 2], \"expected\": [2, 1, 2], \"passed\": false}, {\"check\": \"all unknown\", \"actual\": [], \"expected\": [1, 1], \"passed\": false}, {\"check\": \"single known\", \"actual\": [1], \"expected\": [1], \"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."}}