Linear Regression · Module 4

Gradient Descent

Loss is a hill. Gradients tell you which way to walk downhill by changing m and b.

Idea

If increasing the slope makes MSE worse, decrease the slope. Repeat small steps until loss stops improving.

m ← m − learning_rate · ∂MSE/∂m
b ← b − learning_rate · ∂MSE/∂b

Diagram — Walk downhill on the loss curve

start (high loss) better m, b parameter value → loss
1Guess

Start with any m, b.

2Measure

Compute MSE.

3Gradient

Which way reduces loss?

4Step

Update m and b a little.

5Repeat

Until loss is stable.

Remember: Learning rate too big → overshoot. Too small → slow learning.