Gradient Descent with Momentum
Lesson Introduction
Welcome back! Today, we'll explore Gradient Descent with Momentum. You've already familiarized yourself with basic gradient descent. However, sometimes gradient descent is slow and gets stuck, especially on bumpy paths to the minimum.
So, how do we speed it up? We use momentum. Imagine pushing a heavy shopping cart. Instead of stopping and starting, you build momentum. This helps you move faster. By the end of this lesson, you'll understand how gradient descent with momentum works, implement it in Python, and see how it improves optimization.
Introducing Momentum
How Velocity Works in Gradient Descent with Momentum
In the basic gradient descent, the update to the parameters is directly proportional to the gradient of the function. However, this approach can be slow due to the oscillations around the minimum.
With momentum, the velocity term is introduced to accelerate gradient vectors in the right directions. Here's a detailed breakdown of how the velocity term works:
- Initial Update (at )
- Velocity starts at zero: .
- The first update is similar to basic gradient descent.
- Subsequent Updates (at )
- The velocity is updated with a fraction of the previous velocity, , scaled by , and the current gradient, scaled by .
- This means that the update direction is influenced not just by the current gradient but also by the past gradients, providing a smoothing effect.
- The point is updated using this velocity.
In essence, the velocity term accumulates the gradients of past steps to create a more stable and faster approach toward the minimum.

