We fit a line to data, that is the simple plan
Predict y from x with slope and bias in hand
But to fit this line just right, we must adjust with care
We need to move the slope and bias, how? The gradients share
Each point brings an error, squared and summed with might
The Mean Squared Error shows us if we're wrong or right
The gradient of this error tells us how to steer
Changing slope and bias till the fit is clear
We calculate the gradient in the error, it's the key
Theta equals theta minus alpha times g
Step by step we update, the loss begins to fall
Stochastic gradient descent, our guide through it all
Now computing with all data can be too slow to run
So we use small batches to help the process done
Or pick a single point, fast and noisy it may be
But it often helps us reach a better minimum, you'll see
At each small step, the formula holds true
We use the slope of loss to tell us what to do
Update slope and bias in tiny guided ways
Repeat this process through many training days
We calculate the gradient in the error, it's the key
Theta equals theta minus alpha times g
Step by step we update, the loss begins to fall
Stochastic gradient descent, our guide through it all
Batch means all the data, one big single move
Mini-batch takes a few points, balancing the groove
Stochastic uses one point, updates fly so fast
Each has its own rhythm, helping training last
We calculate the gradient in the error, it's the key
Theta equals theta minus alpha times g
Step by step we update, the loss begins to fall
Stochastic gradient descent, our guide through it all