Why does gradient descent oscillate when features are not scaled?
Gradient descent oscillates when features are not scaled because features with vastly different ranges cause the gradients with respect to their corresponding parameters to differ greatly. This leads to small step sizes for parameters of small-scale features and large step sizes for parameters of large-scale features, resulting in an inefficient, zigzagging path toward the minimum.
Conditions
- Used in linear regression optimization with gradient descent.
- Features have significantly different scales (e.g., one ranges from 0 to 1, another from 100 to 1000).
Reasoning, step by step
- Analyze the gradient descent update rule: the change in parameter is proportional to the feature value .
- Observe that if is small, the step size for will be small.
- Observe that if is large, the step size for will be large.
- Conclude that this disparity in step sizes causes the optimization path to oscillate inefficiently across the narrow dimension of the cost function's contours, delaying convergence.
Example
The video visualizes this with a contour plot showing an elongated valley and a red zigzagging path moving towards the minimum, caused by and .
Common misconceptions
- Believing that a smaller learning rate fixes the oscillation without scaling; it only slows down the large steps, making the small steps even slower.
- Assuming that gradient descent always takes a direct path to the minimum regardless of feature scales.
Watch the explanation
3:36 – 4:11Watch this moment ↗
Explore next
Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.