Normalization Arithmetic

Ada re-derives this chapter’s own numbers step by step, at full precision

foundations
math-foundations
calculation-audit
analytics-ml
Ada ADA · CALCULATION AUDIT

Normalization Arithmetic

The chapter normalizes five temperature readings — 18, 22, 25, 19, 21 C — two ways: min-max scaling puts 22 C at 0.571, while z-score places it at 0.408 standard deviations. The two methods disagree on purpose, and a wrong scale silently reweights every downstream model. This audit re-derives the normalization arithmetic at full precision to show why an outlier that pushes the max to 85 collapses that same 0.571 reading.

Companion to the chapter Lab: Feature Scaling — every number here comes from that chapter.

Ada: Normalization decides how much each sensor channel is allowed to say, so a wrong scale silently reweights every downstream model. Let me re-derive the worked example above at full precision using only its five readings: 18, 22, 25, 19, 21 (degrees C).

Min-max scaling uses x' = (x - x_min) / (x_max - x_min) with x_min = 18 and x_max = 25, so the range is 25 - 18 = 7:

  • 18 C: (18 - 18) / 7 = 0 / 7 = 0.000000
  • 19 C: (19 - 18) / 7 = 1 / 7 = 0.142857
  • 21 C: (21 - 18) / 7 = 3 / 7 = 0.428571
  • 22 C: (22 - 18) / 7 = 4 / 7 = 0.571429, rounded to 0.571.
  • 25 C: (25 - 18) / 7 = 7 / 7 = 1.000000.

Z-score uses z = (x - mu) / sigma. The mean is mu = (18 + 22 + 25 + 19 + 21) / 5 = 105 / 5 = 21. The population standard deviation:

  • Squared deviations: (18-21)^2 + (22-21)^2 + (25-21)^2 + (19-21)^2 + (21-21)^2 = 9 + 1 + 16 + 4 + 0 = 30
  • Variance: 30 / 5 = 6
  • sigma = sqrt(6) = 2.449490, rounded to 2.449.
  • For 22 C: (22 - 21) / 2.449490 = 0.408248, about 0.408.
  • For 25 C: (25 - 21) / 2.449490 = 1.632993, about 1.633.

The two methods disagree on purpose. Min-max forces 25 C to exactly 1.000, its meaning tied to the observed max; z-score places 25 C at 1.633 standard deviations, its meaning tied to the spread. The audit conclusion is narrow: if a later outlier pushes x_max to 85, the same 22 C reading that scaled to 0.571 here collapses toward (22 - 18) / (85 - 18) = 4 / 67 = 0.059701, about 0.060, which is why the chapter reaches for robust scaling when spikes are expected.

Every number above is taken from the chapter’s own material and re-derived step by step.