C.W.K.
Stream
Lesson 03 of 05 · published

Z-Scores: Comparing Apples to Oranges

~8 min · z-score, standardization, comparison

Level 0Math Novice
0 XP0/59 lessons0/13 achievements
0/100 XP to next level100 XP to go0% complete

Different Units, Same Ruler

How do you compare a student's math score (out of 100) to her physics score (out of 50)? Or income in dollars to height in centimeters? You convert each to a z-score:

The z-score says "how many standard deviations away from the mean is this value?" The original units cancel out. A z-score of +1.5 in math means the same thing as a z-score of +1.5 in physics: 1.5 standard deviations above average.

Standard Normal Distribution

If you z-score-transform a normal distribution with any , you get the standard normal with . This is the canonical bell curve, and it's the basis for all the lookup tables in old stats textbooks.

Why ML Loves Standardization

Z-score standardization (covered in the Numbers track) brings features onto comparable scales. Most neural networks train better when inputs are roughly z-scored. Most regression coefficients are interpretable when features are z-scored. Most outlier detectors flag |z| > 3 as suspicious.

Z-scores erase the units. After standardization, every feature speaks the same language: "how many standard deviations from average?"

Code

Two scales become one·python
import numpy as np

scores_math = np.random.normal(70, 10, 100)
scores_physics = np.random.normal(60, 5, 100)

# Z-score each
z_math = (scores_math - scores_math.mean()) / scores_math.std()
z_physics = (scores_physics - scores_physics.mean()) / scores_physics.std()

print(f"math   z: mean={z_math.mean():.3f}, std={z_math.std():.3f}")
print(f"physics z: mean={z_physics.mean():.3f}, std={z_physics.std():.3f}")
# Both: mean ≈ 0, std ≈ 1 — directly comparable

External links

Exercise

A student scores 85 in math (class μ=70, σ=10) and 65 in physics (class μ=55, σ=5). Compute z-scores. Which subject is the student doing better in, relative to peers?
Hint
z_math = (85-70)/10 = 1.5; z_physics = (65-55)/5 = 2.0. Physics is the better performance, even though the raw score is lower — z-scores reveal it.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.