Standardization › Visual Example
Michael BrenndoerferApril 25, 20254 min read
Machine Learning from ScratchAll chapters Part 3 of 9Foundations
Standardization › Visual ExampleOne section · Sections in this chapter4 / 10 ↓
Sections in this chapter10
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
This example demonstrates how standardization maps features with different scales into a common scale:
Out[2]:
Visualization

Original data: House Size - Mean: 1516.67 Std: 338.71 Bedrooms - Mean: 3.0 Std: 0.82 Standardized data: House Size - Mean: -0.0 Std: 1.0 Bedrooms - Mean: 0.0 Std: 1.0
Example: Step-by-Step Calculation
Let's work through a detailed example with two features:
x1: house size in square feet → [1000, 1500, 2000]x2: number of bedrooms → [2, 3, 4]
Step 1: Calculate means
Step 2: Calculate standard deviations
Step 3: Apply standardization formula
For the first feature ():
For the second feature ():
Result: Both features are now on the same scale:
x1: [1000, 1500, 2000] → [-1.225, 0.000, 1.225]x2: [2, 3, 4] → [-1.225, 0.000, 1.225]