Lesson 5 of 9 9 min · 128 words
Gradient descent for regression
Training the same model iteratively when data is large.
For large datasets or many features, train with gradient descent instead. The gradient of the mean squared error is:
Each step: compute predictions, compute errors , multiply by , and update . Because the MSE is convex, gradient descent reaches the same solution as the normal equation (with a suitable ).
Feature scaling is essential here: if one feature ranges in thousands and another in fractions, the loss bowl is a long thin valley and gradient descent zig-zags. Standardising features (zero mean, unit variance) makes it round and convergence fast.
Formula to remember
RMSE
Error in the target's units; punishes big errors.
Quick check · +5 XP