Last time I covered embeddings and promised to get into how you tell if a model actually works. Short version: models cheat whenever you give them a chance. Here’s how they do it and how to stop them.
One-hot encoding: the simple way
Before embeddings, there was one-hot encoding. It’s a giant checklist. Red, Blue, Green become [1,0,0], [0,1,0], [0,0,1].
It’s simple, and it’s dumb. Red is as different from Pink as it is from Tractor. No relationships, no nuance. And 10,000 categories means 10,000 columns, which gets expensive fast.
It’s fine for a handful of categories (say, a column with three possible values). For anything bigger, use embeddings.
Stop splitting your data randomly
This is where a lot of people mess up. You split data 80/20 into training and validation, and the default move is to shuffle randomly first.
Don’t do that with time series data (sales, stock prices, anything ordered by date).
A random split lets the model cheat. It sees Tuesday, skips Wednesday, sees Thursday. When you ask it to predict Wednesday, it isn’t predicting. It’s interpolating between two days it already saw.
Split by time instead. Train on the first 18 months, validate on the last 6. Now the model has to predict a future it hasn’t seen, which is the job you actually need it to do.
Accuracy lies
Everyone chases high accuracy. It feels good. But it can be badly misleading.
Say you build a detector for a disease that affects 1 in 1,000 people. A model that always answers “no disease” is 99.9% accurate. It also misses every sick person, which makes it useless.
So look at more than one number:
- Precision and recall. Recall asks: of the real cases, how many did you catch? Precision asks: of the alarms you raised, how many were real? The “always no” model has a recall of zero, which exposes it immediately.
- Confusion matrix. Shows exactly which classes the model mixes up.
- The eye test. Pull up the rows it gets wrong and look for a pattern.
For forecasts, also plot predictions against actuals over time. If the model gets the overall trend wrong, a good average score won’t save it.
The real lesson
Hitting run and watching the loss go down is the easy part. The hard part is setting up a test the model can’t game. Give it a random split and a single metric, and it’ll find the easiest path, which usually isn’t real learning.
It’s like a student who memorizes the practice test. They ace it because they remember the questions. Give them the real exam with different wording and they’re lost, because they never learned the material.