Intermediate Topic 18 of 51 AI & Machine Learning
Gradient Descent
Iteratively stepping against the gradient to minimize loss.
How it works
Gradient descent minimizes a loss function by repeatedly moving the parameters a small step in the direction opposite to the gradient, the direction of steepest increase, so theta becomes theta minus learning rate times the gradient. Batch gradient descent uses the whole dataset per step, stochastic gradient descent uses one example and mini-batches strike a balance. Variants such as momentum, RMSprop and Adam adapt step sizes and smooth updates.
Step-by-step walkthrough
- Start with random parameters.
- Compute the gradient of the loss, the uphill direction.
- Take a small step the opposite way, size set by the learning rate.
- Repeat many times.
- The loss settles at a minimum.
Where it is used
Training linear and logistic regression, neural networks and almost all modern machine-learning models rely on gradient descent and its variants, with gradients computed by backpropagation.
Common pitfall
A learning rate that is too large diverges, while one too small is painfully slow. Non-convex losses have local minima, saddle points and plateaus. Unscaled features cause zigzagging. Vanishing or exploding gradients affect deep networks. Normalize inputs, use learning-rate schedules and adaptive optimizers, monitor the loss curve and clip gradients when needed.
Where it fits in the course
Gradient Descent is topic 18 of 51 in AI & Machine Learning, rated Intermediate. It follows Cross-Validation. The next topic is Loss Functions.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the AI & Machine Learning quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the AI & Machine Learning quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Gradient Descent?
Where do people use Gradient Descent?
What is the most common mistake with Gradient Descent?
What should I learn before this topic?
How can I practice it?
Is Gradient Descent hard to learn?
How long does it take to learn Gradient Descent?
Which topics are related to Gradient Descent?
What should I study after Gradient Descent?
Related topics
- Cross-Validation (AI & Machine Learning)
- Loss Functions (AI & Machine Learning)
- Confusion Matrix (AI & Machine Learning)
- Regularization (AI & Machine Learning)
- Recursive Descent Parsing (Languages & Compilers)