Foundations — Feature scaling - normalization vs standardization
This page assumes you have seen nothing. Before you can read Feature scaling - normalization vs standardization, you must be able to read every squiggle it uses. We build them one at a time, each on top of the last.
0. What is a "feature" and a "dataset"?
Everything starts here, so we start here.

Look at the figure. The whole table is the dataset. The amber column is one feature — "price" — pulled out as a list of numbers. Feature scaling always operates on one column at a time: it looks down a column, and rewrites those numbers.
Why the topic needs this: scaling never mixes columns. It reads all the values in a single column to decide how to rewrite that column. (Feature types are covered in 2.1.01-Feature-types-and-data-structures.)
1. The symbol — a feature's values
Picture it: if the price column is (thousands of dollars), then is that whole list, and one specific might be .
Why the topic needs it: every scaling formula is a rule of the form "take one value , do arithmetic, get a new value ". Writing it once with the symbol saves us from rewriting it for every row.
2. The symbols and — the ends of the range

In the figure, the column's numbers are dots on a horizontal line. is the leftmost dot, the rightmost. The distance between them — the cyan bar — is called the range:
The range is literally "how wide is the spread of this column, end to end". A price column might have range ; a bedroom column range . That mismatch is the whole problem feature scaling solves.
Why the topic needs it: normalization uses exactly these two numbers to squash any column into the window .
3. Subtraction as "shifting", division as "stretching"
Before any formula, understand what the two operations do to a picture.

Top row: original dots. Middle: after subtracting a number — every dot slides left by the same amount, spacing unchanged. Bottom: after dividing — the dots pull together toward 0, spacing shrinks by the same factor.
Why the topic needs it: every scaling formula is exactly "shift, then stretch". If you see subtraction, think slide the line. If you see division, think rescale the ruler. That is all the algebra ever does.
4. The mean — the balance point
Here is how many values there are, and are the individual values. The three dots just mean "keep going in the same pattern".
Picture: if the dots were beads on a stiff wire, is the point where the wire balances on a fingertip. Big lonely values (outliers) pull the balance point toward themselves.
Why the topic needs it: standardization slides the whole column so that its balance point sits exactly at . That is the "subtract " step.
5. Variance and standard deviation — the typical spread
Now we need a number for "how spread out is the column", but a smarter one than range (which only looks at the two extreme dots).
Let us earn every piece:
- is "how far this value sits from the balance point" — could be negative (below) or positive (above).
- We square it, , for two reasons: squaring kills the minus sign (so below-average and above-average both count as positive spread), and it punishes far-away values more.
- We average the squares to get one summary number.

Why take the square root? Variance is in squared units (squared dollars — meaningless to a human). The square root brings us back to the original units, so answers "a typical distance from the mean, in the same units as the data". In the figure, is drawn as the cyan half-width band around — roughly where the "normal, non-extreme" values live.
Why the topic needs it: standardization stretches the column so that its typical spread becomes exactly . That is the "divide by " step. Outlier treatment builds on this idea in 2.1.05-Handling-outliers-detection-and-treatment.
6. Expected value — the mean, in disguise
Why does the parent note use both and ? Because when we transform data (multiply, add), the notation lets us write clean rules like — "scaling and shifting inside the average pops right out". You do not need probability theory; just read as "the average of whatever is inside the brackets".
7. A linear transformation — the master shape, and how to solve for it
Every scaling formula the parent note derives has the same skeleton. Here we not only name it, we derive the two recipes so nothing is dropped from the sky.
Recipe A — Normalization (target: send and ).
We have two demands, which give two equations:
Demand 1 — the smallest value must land on :
Demand 2 — the largest value must land on . Substitute the we just found:
So the stretch is (one over the range — makes sense: to squeeze a width- column into width , divide by ). Feed that back into to get . Putting them together: The subtraction slides onto ; the division shrinks the range to exactly .
Recipe B — Standardization (target: mean becomes , spread becomes ).
Demand 1 — the new mean must be . Using :
Demand 2 — the new spread must be . Stretching by multiplies the standard deviation by , so we need , giving . Then . Together: Subtracting centres the balance point on ; dividing by makes the typical spread exactly .
| Recipe | target | (stretch) | (shift) |
|---|---|---|---|
| Normalization | min , max | ||
| Standardization | mean , spread |
Why the topic needs it: once you know it is always "solve for and to hit a target", the parent note's derivations stop looking like magic — you are just matching demands to equations.
8. The dangerous edge cases — when the denominator is zero
Both recipes divide — by the range for normalization, by for standardization. Division by zero is undefined, so we must ask: can those denominators ever be zero? Yes, and in exactly one situation each.
The picture makes it obvious: if all the dots sit on one single point, there is no range and no spread to stretch — there is nothing to rescale.
Why the topic needs it: real datasets contain constant or near-constant columns all the time. Knowing why the formula breaks — zero range, zero variance — lets you spot and handle it instead of shipping silent NaNs into the model.
Equipment checklist
Cover the right side and answer aloud. If any stumps you, reread that section.