cd /news/machine-learning/what-an-over-engineered-parity-class… · home › topics › machine-learning › article
[ARTICLE · art-140178] src=dev.to ↗ pub= topic=machine-learning verified=true sentiment=· neutral

What an Over-Engineered Parity Classifier Taught Me About Representation

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.

by read7 min views1 publishedSep 26, 2026

A while ago, I built a deliberately over-engineered classifier for one of the easiest problems in computer science:

Is an integer odd or even?

In binary, the answer is already sitting in the least significant bit.

0 means even.

1 means odd.

No machine learning is needed.

And 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.

The first version of the experiment looked interesting. It reported about 69.67% accuracy.

But when I came back to the project and started preparing a proper revision, I found something more important than the original result:

the experiment itself needed to be rethought.

That ended up making the project much more interesting.

The first issue was label leakage.

I 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.

That meant information from the data being evaluated could influence the mapping from clusters to parity labels.

The second issue was more conceptual.

I had described the method as unsupervised because k-means itself never receives parity labels.

That is only partly true.

The clustering step is unsupervised, but the final cluster-to-parity mapping uses labels. So the complete classifier is not fully unsupervised.

Those two details changed how the result should be interpreted.

Instead of trying to defend the original framing, I decided to rebuild the experiment around a stricter evaluation protocol.

The revised study uses all integers from 0 to 10,000.

Each integer is converted into a fixed-width 32-bit binary signal.

The primary pipeline is:

Integer
   ↓
32-bit binary representation
   ↓
level-3 db2 wavelet transform
   ↓
mean absolute coefficient magnitude
   ↓
k-means per wavelet subband
   ↓
training-only cluster calibration
   ↓
odd / even prediction

The data is split into:

Representation and model choices are made using only training and validation data.

Once 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.

The result:

84.26% held-out test accuracy

with a 95% Wilson confidence interval of:

82.60%–85.79%

Across 20 different stratified train/test splits, the same representation achieved:

84.20% ± 0.57%

So the revised result is numerically stronger than the original one.

But that is not the part I find most interesting.

Parity is determined by one bit.

So the cleanest test is simple:

remove that bit.

When I mask the natural least significant bit and keep the rest of the wavelet pipeline unchanged, validation accuracy drops to:

48.15%

That is essentially chance.

This is important because it rules out the strongest interpretation of the model.

The pipeline is not discovering the abstract arithmetic rule of parity.

It is using information that is already present in the binary representation.

The interesting question becomes:

Why is that information so easy to recover in some representations and almost impossible to recover in others?

The standard representation uses left-zero padding.

If I keep the same 32-bit signal but switch to right padding, validation accuracy drops to:

65.20%

The parity rule did not change.

The bits did not contain less information.

Only their position inside the signal changed.

That was the first strong hint that the wavelet transform was creating a geometry that depends heavily on spatial layout.

A level-3 wavelet decomposition produces one approximation band and three detail bands:

Subband Validation accuracy
A3 83.20%
D3 52.35%
D2 50.30%
D1 50.40%

This surprised me.

Parity depends on a single bit, so I initially expected the fine-scale detail coefficients to matter most.

Instead, the approximation band A3 contains almost the entire predictive signal.

I then compared it with simpler coarse representations:

Representation Validation accuracy
db2 A3 83.20%
Haar A3 61.30%
Raw MAV 61.30%
3-level average pooling 61.30%
Triangular low-pass 51.40%

So this is not just an averaging effect.

Something specific about the interaction between the db2 filters, downsampling, signal layout, and boundary handling makes the parity bit unusually accessible.

This was probably the most revealing experiment.

I kept exactly the same 32 bits.

I did not add information.

I did not remove information.

I only moved the parity-carrying bit to different positions in the signal.

The result changed dramatically.

At the natural position, validation accuracy is:

83.20%

At some positions, it falls much closer to chance.

At the best tested position, it reaches:

98.60%

Nothing about the underlying parity information changed.

Only its position changed.

That makes the interpretation much clearer:

the model is not learning a representation-independent rule.

It is exploiting a representation-dependent structure created by the transform.

Wavelet transforms need a rule for what happens at the edges of a finite signal.

I tested several boundary-extension modes while keeping the rest of the model fixed.

The resulting validation accuracy ranged from:

54.45% to 83.20%

That is a huge swing from what might look like a low-level implementation choice.

In this experiment, boundary handling is not a minor detail.

It is part of the mechanism.

I also froze the model trained on 0–10,000 and evaluated it on increasingly distant numerical ranges without recalibration.

Test range Accuracy
10,001–20,000 79.98%
20,001–50,000 71.51%
50,001–100,000 66.32%
100,001–1,000,000 59.69%

Performance steadily degrades as the magnitude distribution moves away from the training range.

At first, that might suggest that larger integers are inherently harder.

But when separate models are trained and tested inside fixed bit-length bands, accuracy remains roughly between 78% and 88%.

So the main problem is not magnitude itself.

It is representation shift.

The geometry that works in one numerical regime does not stay stable in another.

On a wider 0–100,000 distribution, I increased the training set from 500 examples all the way to 80,000.

The performance ceiling barely moved.

That suggests the bottleneck is not the amount of data.

The bottleneck is the representation and the very simple clustering model operating on top of it.

The first version of this project was mostly about a surprising classifier result.

The revised version is not.

The more interesting story is that the same symbolic information can become easy, difficult, or almost impossible to recover depending on how it is represented.

That changed how I think about the experiment.

The question is no longer:

“Can wavelets classify parity?”

Of course parity can be solved exactly with one bit.

The better question is:

“What does the representation make accessible to a simple model?”

That is a much more general machine-learning question.

A model can perform well without learning the abstract rule we think it learned.

Sometimes preprocessing creates a useful proxy.

Sometimes position matters more than expected.

Sometimes a boundary condition changes the geometry enough to alter the result completely.

And sometimes the right experiment is not another accuracy benchmark, but an ablation that tells you where the accuracy came from.

Finding problems in an earlier experiment is uncomfortable.

But I think revisiting it made the work much stronger.

The revised version now:

The final claim is narrower than the original one.

I am much more comfortable with it because of that.

The wavelet pipeline does not discover parity as an abstract arithmetic rule.

Instead, it shows how a classical signal-processing transform can make symbolic information that is already present in the input more or less statistically accessible.

For me, that ended up being the real result.

The code, frozen experiment artifacts, prediction outputs, and analysis results are available here:

GitHub:

https://github.com/Ertugrulmutlu/Using-Wavelets-and-Clustering-to-Predict-Odd-or-Even-Numbers

For the exact manuscript snapshot, use the Git tag:

paper-v2

The revised arXiv version is scheduled to become public on September 29, 2026.

Paper:

https://arxiv.org/abs/2511.00071

This project started as an unnecessarily complicated way to answer a one-bit question.

The revision taught me something more useful than the original accuracy number:

Before asking what a model learned, ask what the representation made easy to learn.

That is the part of this experiment I will probably remember.

── more in #machine-learning 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/what-an-over-enginee…] indexed:0 read:7min 2026-09-26 · —