Day19 : Normalizer Lab
Lesson: Normalizer Lab — Scaling & Normalization From Scratch
The sklearn.fit() Trap
Here is how every tutorial teaches normalization:
Two lines. It works. And it hides everything worth knowing.
What fit_transform actually does is compute mean and std per feature
column, subtract the mean, divide by std. That's four NumPy operations. But
once you've typed StandardScaler(), you no longer know:
What happens when a column has
std = 0? (Hint: silent NaN.)Why do you call
fiton train and onlytransformon test? (Hint: data leakage.)Why does L2 normalization work per-row while Standard works per-column?
What does "robust" actually mean, and what is it robust to?
The abstraction isn't wrong — it's appropriate for production pipelines.
But if you reach for it before understanding the underlying math, you will
misuse it. You will fit on the full dataset, you will fail to handle
constant columns, and you will wonder why your model outputs NaN with no
error message.
Keep going with the full lesson
The rest of this lesson — plus its implementation guide, runnable scripts and source code — is included with the course or an All Access plan. Create a free account to start the free lessons in every course.
Already a member? Sign in