{"abstract":"Training frequency encoding uses held-out rows while fitting.","category":"Feature preprocessing fit scope","checks":7,"contract":"Encode each scalar string with its relative frequency in the training sequence. Unseen values map to zero; an empty training sequence maps all transforms to zero.","contract_signature":"train, values","evaluation_group":"w3-feature-preprocessing-fit-scope-training-frequency","failed_approach":"Filtering rows after computing the statistic still leaves held-out influence.","family":"w3-feature-preprocessing-fit-scope-training-frequency-fit-leakage","id":"FA-100391","implementations":{"attempt":{"sha256":"dee0d53e0fd8cb9fd804e5688eb373f37544b7111cdcdd194599d170897a3922","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(train, values):\n    from collections import Counter\n    c=Counter(train+values); return [c[x]/len(train) if train else 0 for x in values]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\na='a'+str(N); check('relative frequencies',solve([a,a,'b'],[a,'b','z']),[2/3,1/3,0])\ncheck('heldout does not alter frequency',solve(['x','y'],['x']),[0.5])\ncheck('empty transform',solve(['x'],[]),[])\ncheck('empty train unknown',solve([],['x']),[0])\ncheck('all same',solve(['x']*N,['x']),[1.0])\ncheck('unseen is zero',solve(['x','x'],['z']),[0])\ncheck('single observed class',solve(['a','b','b'],['b']),[2/3])\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":"f39a7470db317a7ed92db1e099a47ce91ecaf6c3b6b7c084ca00636ccc6b18c6","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(train, values):\n    from collections import Counter\n    c=Counter(train+values); return [c[x]/len(train+values) if train+values else 0 for x in values]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\na='a'+str(N); check('relative frequencies',solve([a,a,'b'],[a,'b','z']),[2/3,1/3,0])\ncheck('heldout does not alter frequency',solve(['x','y'],['x']),[0.5])\ncheck('empty transform',solve(['x'],[]),[])\ncheck('empty train unknown',solve([],['x']),[0])\ncheck('all same',solve(['x']*N,['x']),[1.0])\ncheck('unseen is zero',solve(['x','x'],['z']),[0])\ncheck('single observed class',solve(['a','b','b'],['b']),[2/3])\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":"Toy empirical category rate encoding; smoothing and target statistics are not modeled. 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-feature-preprocessing-fit-scope-training-frequency-fit-leakage","generated_at":"2026-09-30T16:48:34.921113+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A small deterministic preprocessing contract makes the fit boundary and transform behavior directly inspectable.","root_cause":"Fitting reads values outside the designated training rows.","sha256":"95d14a6966a8ab0acfd30b2da4b1bd928722e4fd632ffc548e916fd0ca44d6fd","title":"Training frequency encoding uses held-out rows while fitting · 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":27.487,"exit_code":1,"observations":[{"actual":[1.0,0.6666666666666666,0.3333333333333333],"check":"relative frequencies","expected":[0.6666666666666666,0.3333333333333333,0],"passed":false},{"actual":[1.0],"check":"heldout does not alter frequency","expected":[0.5],"passed":false},{"actual":[],"check":"empty transform","expected":[],"passed":true},{"actual":[0],"check":"empty train unknown","expected":[0],"passed":true},{"actual":[2.0],"check":"all same","expected":[1.0],"passed":false},{"actual":[0.5],"check":"unseen is zero","expected":[0],"passed":false},{"actual":[1.0],"check":"single observed class","expected":[0.6666666666666666],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"relative frequencies\", \"actual\": [1.0, 0.6666666666666666, 0.3333333333333333], \"expected\": [0.6666666666666666, 0.3333333333333333, 0], \"passed\": false}, {\"check\": \"heldout does not alter frequency\", \"actual\": [1.0], \"expected\": [0.5], \"passed\": false}, {\"check\": \"empty transform\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty train unknown\", \"actual\": [0], \"expected\": [0], \"passed\": true}, {\"check\": \"all same\", \"actual\": [2.0], \"expected\": [1.0], \"passed\": false}, {\"check\": \"unseen is zero\", \"actual\": [0.5], \"expected\": [0], \"passed\": false}, {\"check\": \"single observed class\", \"actual\": [1.0], \"expected\": [0.6666666666666666], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":28.373,"exit_code":1,"observations":[{"actual":[0.5,0.3333333333333333,0.16666666666666666],"check":"relative frequencies","expected":[0.6666666666666666,0.3333333333333333,0],"passed":false},{"actual":[0.6666666666666666],"check":"heldout does not alter frequency","expected":[0.5],"passed":false},{"actual":[],"check":"empty transform","expected":[],"passed":true},{"actual":[1.0],"check":"empty train unknown","expected":[0],"passed":false},{"actual":[1.0],"check":"all same","expected":[1.0],"passed":true},{"actual":[0.3333333333333333],"check":"unseen is zero","expected":[0],"passed":false},{"actual":[0.75],"check":"single observed class","expected":[0.6666666666666666],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"relative frequencies\", \"actual\": [0.5, 0.3333333333333333, 0.16666666666666666], \"expected\": [0.6666666666666666, 0.3333333333333333, 0], \"passed\": false}, {\"check\": \"heldout does not alter frequency\", \"actual\": [0.6666666666666666], \"expected\": [0.5], \"passed\": false}, {\"check\": \"empty transform\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"empty train unknown\", \"actual\": [1.0], \"expected\": [0], \"passed\": false}, {\"check\": \"all same\", \"actual\": [1.0], \"expected\": [1.0], \"passed\": true}, {\"check\": \"unseen is zero\", \"actual\": [0.3333333333333333], \"expected\": [0], \"passed\": false}, {\"check\": \"single observed class\", \"actual\": [0.75], \"expected\": [0.6666666666666666], \"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."}}