{"slug": "what-an-over-engineered-parity-classifier-taught-me-about-representation", "title": "What an Over-Engineered Parity Classifier Taught Me About Representation", "summary": "A developer rebuilt an over-engineered parity classifier after finding label leakage and a mislabeled unsupervised framing in the original experiment, moving to a stricter train/validation/test protocol over all integers from 0 to 10,000. The revised wavelet-plus-k-means pipeline reached 84.26% held-out test accuracy (95% Wilson CI 82.60%–85.79%), but masking the least significant bit dropped validation accuracy to 48.15%, showing the model exploits information already present in the binary representation rather than learning the abstract parity rule. Switching from left-zero to right padding cut validation accuracy to 65.20%, indicating the wavelet geometry depends heavily on bit position.", "body_md": "A while ago, I built a deliberately over-engineered classifier for one of the easiest problems in computer science:\n\n**Is an integer odd or even?**\n\nIn binary, the answer is already sitting in the least significant bit.\n\n`0` means even.\n\n`1` means odd.\n\nNo machine learning is needed.\n\nAnd yet I passed those binary representations through a wavelet transform, summarized the coefficients, clustered them with k-means, and tried to recover parity from the resulting feature space.\n\nThe first version of the experiment looked interesting. It reported about **69.67% accuracy**.\n\nBut when I came back to the project and started preparing a proper revision, I found something more important than the original result:\n\n**the experiment itself needed to be rethought.**\n\nThat ended up making the project much more interesting.\n\nThe first issue was **label leakage**.\n\nI used parity labels to estimate whether each cluster was mostly odd or mostly even. But the evaluation was not cleanly separated from that calibration step.\n\nThat meant information from the data being evaluated could influence the mapping from clusters to parity labels.\n\nThe second issue was more conceptual.\n\nI had described the method as **unsupervised** because k-means itself never receives parity labels.\n\nThat is only partly true.\n\nThe clustering step is unsupervised, but the final cluster-to-parity mapping uses labels. So the complete classifier is not fully unsupervised.\n\nThose two details changed how the result should be interpreted.\n\nInstead of trying to defend the original framing, I decided to rebuild the experiment around a stricter evaluation protocol.\n\nThe revised study uses all integers from `0` to `10,000`.\n\nEach integer is converted into a fixed-width 32-bit binary signal.\n\nThe primary pipeline is:\n\n```\nInteger\n   ↓\n32-bit binary representation\n   ↓\nlevel-3 db2 wavelet transform\n   ↓\nmean absolute coefficient magnitude\n   ↓\nk-means per wavelet subband\n   ↓\ntraining-only cluster calibration\n   ↓\nodd / even prediction\n```\n\nThe data is split into:\n\nRepresentation and model choices are made using only training and validation data.\n\nOnce the configuration is frozen, the model is re-fit on the combined train and validation sets and evaluated once on the held-out test set.\n\nThe result:\n\n**84.26% held-out test accuracy**\n\nwith a 95% Wilson confidence interval of:\n\n**82.60%–85.79%**\n\nAcross 20 different stratified train/test splits, the same representation achieved:\n\n**84.20% ± 0.57%**\n\nSo the revised result is numerically stronger than the original one.\n\nBut that is not the part I find most interesting.\n\nParity is determined by one bit.\n\nSo the cleanest test is simple:\n\n**remove that bit.**\n\nWhen I mask the natural least significant bit and keep the rest of the wavelet pipeline unchanged, validation accuracy drops to:\n\n**48.15%**\n\nThat is essentially chance.\n\nThis is important because it rules out the strongest interpretation of the model.\n\nThe pipeline is not discovering the abstract arithmetic rule of parity.\n\nIt is using information that is already present in the binary representation.\n\nThe interesting question becomes:\n\n**Why is that information so easy to recover in some representations and almost impossible to recover in others?**\n\nThe standard representation uses left-zero padding.\n\nIf I keep the same 32-bit signal but switch to right padding, validation accuracy drops to:\n\n**65.20%**\n\nThe parity rule did not change.\n\nThe bits did not contain less information.\n\nOnly their **position inside the signal** changed.\n\nThat was the first strong hint that the wavelet transform was creating a geometry that depends heavily on spatial layout.\n\nA level-3 wavelet decomposition produces one approximation band and three detail bands:\n\n| Subband | Validation accuracy | \n|---|---|\n| A3 | **83.20%** | \n| D3 | 52.35% | \n| D2 | 50.30% | \n| D1 | 50.40% | \n\nThis surprised me.\n\nParity depends on a single bit, so I initially expected the fine-scale detail coefficients to matter most.\n\nInstead, the approximation band `A3` contains almost the entire predictive signal.\n\nI then compared it with simpler coarse representations:\n\n| Representation | Validation accuracy | \n|---|---|\n| db2 A3 | **83.20%** | \n| Haar A3 | 61.30% | \n| Raw MAV | 61.30% | \n| 3-level average pooling | 61.30% | \n| Triangular low-pass | 51.40% | \n\nSo this is not just an averaging effect.\n\nSomething specific about the interaction between the db2 filters, downsampling, signal layout, and boundary handling makes the parity bit unusually accessible.\n\nThis was probably the most revealing experiment.\n\nI kept exactly the same 32 bits.\n\nI did not add information.\n\nI did not remove information.\n\nI only moved the parity-carrying bit to different positions in the signal.\n\nThe result changed dramatically.\n\nAt the natural position, validation accuracy is:\n\n**83.20%**\n\nAt some positions, it falls much closer to chance.\n\nAt the best tested position, it reaches:\n\n**98.60%**\n\nNothing about the underlying parity information changed.\n\nOnly its position changed.\n\nThat makes the interpretation much clearer:\n\n**the model is not learning a representation-independent rule.**\n\nIt is exploiting a representation-dependent structure created by the transform.\n\nWavelet transforms need a rule for what happens at the edges of a finite signal.\n\nI tested several boundary-extension modes while keeping the rest of the model fixed.\n\nThe resulting validation accuracy ranged from:\n\n**54.45% to 83.20%**\n\nThat is a huge swing from what might look like a low-level implementation choice.\n\nIn this experiment, boundary handling is not a minor detail.\n\nIt is part of the mechanism.\n\nI also froze the model trained on `0–10,000` and evaluated it on increasingly distant numerical ranges without recalibration.\n\n| Test range | Accuracy | \n|---|---|\n| 10,001–20,000 | 79.98% | \n| 20,001–50,000 | 71.51% | \n| 50,001–100,000 | 66.32% | \n| 100,001–1,000,000 | 59.69% | \n\nPerformance steadily degrades as the magnitude distribution moves away from the training range.\n\nAt first, that might suggest that larger integers are inherently harder.\n\nBut when separate models are trained and tested inside fixed bit-length bands, accuracy remains roughly between **78% and 88%**.\n\nSo the main problem is not magnitude itself.\n\nIt is **representation shift**.\n\nThe geometry that works in one numerical regime does not stay stable in another.\n\nOn a wider `0–100,000` distribution, I increased the training set from 500 examples all the way to 80,000.\n\nThe performance ceiling barely moved.\n\nThat suggests the bottleneck is not the amount of data.\n\nThe bottleneck is the representation and the very simple clustering model operating on top of it.\n\nThe first version of this project was mostly about a surprising classifier result.\n\nThe revised version is not.\n\nThe more interesting story is that the **same symbolic information can become easy, difficult, or almost impossible to recover depending on how it is represented**.\n\nThat changed how I think about the experiment.\n\nThe question is no longer:\n\n“Can wavelets classify parity?”\n\nOf course parity can be solved exactly with one bit.\n\nThe better question is:\n\n**“What does the representation make accessible to a simple model?”**\n\nThat is a much more general machine-learning question.\n\nA model can perform well without learning the abstract rule we think it learned.\n\nSometimes preprocessing creates a useful proxy.\n\nSometimes position matters more than expected.\n\nSometimes a boundary condition changes the geometry enough to alter the result completely.\n\nAnd sometimes the right experiment is not another accuracy benchmark, but an ablation that tells you **where the accuracy came from**.\n\nFinding problems in an earlier experiment is uncomfortable.\n\nBut I think revisiting it made the work much stronger.\n\nThe revised version now:\n\nThe final claim is narrower than the original one.\n\nI am much more comfortable with it because of that.\n\nThe wavelet pipeline does **not** discover parity as an abstract arithmetic rule.\n\nInstead, it shows how a classical signal-processing transform can make symbolic information that is already present in the input more or less statistically accessible.\n\nFor me, that ended up being the real result.\n\nThe code, frozen experiment artifacts, prediction outputs, and analysis results are available here:\n\n**GitHub:**\n\n[https://github.com/Ertugrulmutlu/Using-Wavelets-and-Clustering-to-Predict-Odd-or-Even-Numbers](https://github.com/Ertugrulmutlu/Using-Wavelets-and-Clustering-to-Predict-Odd-or-Even-Numbers)\n\nFor the exact manuscript snapshot, use the Git tag:\n\n`paper-v2`\n\nThe revised arXiv version is scheduled to become public on September 29, 2026.\n\n**Paper:**\n\n[https://arxiv.org/abs/2511.00071](https://arxiv.org/abs/2511.00071)\n\nThis project started as an unnecessarily complicated way to answer a one-bit question.\n\nThe revision taught me something more useful than the original accuracy number:\n\n**Before asking what a model learned, ask what the representation made easy to learn.**\n\nThat is the part of this experiment I will probably remember.", "url": "https://wpnews.pro/news/what-an-over-engineered-parity-classifier-taught-me-about-representation", "canonical_source": "https://dev.to/ertugrulmutlu/what-an-over-engineered-parity-classifier-taught-me-about-representation-40c8", "published_at": "2026-09-26 16:23:53+00:00", "updated_at": "2026-09-26 16:58:55.222062+00:00", "lang": "en", "topics": ["machine-learning", "ai-research", "neural-networks"], "entities": [], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/what-an-over-engineered-parity-classifier-taught-me-about-representation", "markdown": "https://wpnews.pro/news/what-an-over-engineered-parity-classifier-taught-me-about-representation.md", "text": "https://wpnews.pro/news/what-an-over-engineered-parity-classifier-taught-me-about-representation.txt", "jsonld": "https://wpnews.pro/news/what-an-over-engineered-parity-classifier-taught-me-about-representation.jsonld"}}