Machine learning with football · Chapter 5 · Numerical data

Normalization

Four ways to bring numbers onto a similar scale, and how the shape of the data picks between them.

Estimated time: 20 minutes · page 4 of 9

Why bring numbers onto one scale

Minutes run from 0 to about 1,000, ratings from 5 to 9. Feed both in raw and gradient descent struggles. A step that suits one is far too big or too small for the other, so training bounces around and takes longer. The model also starts out treating the wide feature as more important. Normalization brings them onto a similar scale, and the right method depends on the shape.

One rule: whatever you do to a feature in training, you have to do in exactly the same way when the model makes predictions later.

MethodFormulaUse it forHere
Linear scaling(x − min) / (max − min)a spread without outliers and with fixed boundsminutes
Z-score(x − mean) / SDa bell shapeaverage rating
Logln(1 + x)a few huge values, a long tail of small onesgoals
Clippingcap at a limitextreme outliersratings from cameos

Try each one on the board. Linear scaling squeezes everything into 0 to 1. A z-score says how many standard deviations a value sits from the mean, so a rating of 7.4 with mean 6.7 and SD 0.37 becomes about +1.9. Log scaling pulls the long tail in: 9 goals becomes ln 10 ≈ 2.3 and 1 goal ln 2 ≈ 0.7. Clipping here caps everything at the mean ± 3 SD, so the extreme ratings stop at the cap instead of disappearing.

Check yourself

A feature is bell-shaped, from 0 to 200,000 with its peak around 100,000. Which scaling?
Goals: 313 of 467 players have none, a few have 8 or 9. Which scaling fits?
Stadium attendance: most matches 20,000 to 60,000, a few cup games in huge stadiums at 90,000, and every thousandth row says 9,999,999 because of an export bug. What is sensible?

Leagues