Log inStart free
LESSON 4.06 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Feature scaling

Watch feature scaling fix a nearest-house search and a gradient descent.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 4.06 · SCALING BAYAREA RANGE 110 M² · DISTANCE RANGE 3.6 KM
01
Stage 1 of 6 · Two scales
Area spans 110 m², and distance spans 3.6 km. On equal axes, the houses fall on one line.
Explain it simply

Each teal dot is a house, placed by its floor area and its distance to the station. Both axes give 1 m² the same length as 1 km. The area numbers are much bigger, so the dots spread along one axis only. A model that adds raw numbers sees this thin line.

8 training houses and a new house on equal axes. Area runs from 55 to 165 m². Distance runs from 0.7 to 4.3 km. The dots lie on a thin line.

houses: area and distance, raw or scaledscaler statistics and the weights wthe nearest house and the best weights w*the loss Ldistances and loss contours
houses on equal axeseach feature on one number line050100150050100150area (m²)distance (km)equal axes: 1 m² as long as 1 kmABCDEFGHN020406080100120140160180raw value (m² or km)areamin 55 · max 165 · range 110 m²distancemin 0.7 · max 4.3 · range 3.6 kmhouses on equal axeseach feature on one number line050100150050100150area (m²)distance (km)equal axes: 1 m² as long as 1 kmABCDEFGHN020406080100120140160180raw value (m² or km)areamin 55 · max 165 · range 110 m²distancemin 0.7 · max 4.3 · range 3.6 km
Toy: 8 houses · 2 features (area, distance to the station) · 1 new house · prices in $1000s
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
range=max⁡x−min⁡x\text{range} = \sy{max}{param}{\max x} - \sy{min}{param}{\min x}
165−55=110 m2,4.3−0.7=3.6 km165 - 55 = 110\ \text{m}^2,\quad 4.3 - 0.7 = 3.6\ \text{km}

The range of a feature is its largest value minus its smallest.

Common mix-ups

MYTHThe unit of a feature does not change the nearest house.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01After scaling, does switching km to m change the nearest house?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.