# #27 Machine Learning Specialization [Course 1, Week 2, Lesson 2] | Summary and Q&A

14.3K views
December 1, 2022
by
DeepLearningAI
#27 Machine Learning Specialization [Course 1, Week 2, Lesson 2]

## TL;DR

Learn how to assess the convergence and performance of gradient descent through learning curves.

## Key Insights

• 🗾 The learning curve of gradient descent helps visualize the convergence by observing the changes in the cost function J after each iteration.
• ☠️ If the cost J increases after an iteration, it suggests a poor learning rate Alpha or a potential bug in the code.
• 😚 The learning curve flattening out indicates convergence, and the model is close to the minimum value of the cost function.
• #️⃣ The number of iterations required for convergence varies across different applications.
• 🗯️ Choosing the right threshold for an automatic convergence test can be challenging, making visual assessment of the learning curve preferable.
• ⚠️ The learning curve provides advanced warning if gradient descent is not functioning correctly.
• ✋ Learning curves are helpful in determining when to stop training a model.

## Transcript

when running gradient descent how can you tell if it is converging that is whether it's helping you to find parameters close to the global minimum of the cost function by learning to recognize what a well-running implementation of gradient descent looks like we will also in a later video be better able to choose the good learning rate Alpha let's t... Read More

## Questions & Answers

### Q: How can you assess if gradient descent is converging?

By plotting the learning curve, one can observe if the cost J decreases after each iteration. If the cost J ever increases, it indicates a poor choice of the learning rate Alpha or a possible bug in the code.

### Q: What does it mean if the learning curve flattens out?

When the learning curve no longer shows a significant decrease in the cost J after a certain number of iterations, it suggests that gradient descent has converged, and the model is close to the minimum possible value of J.

### Q: How can the learning curve help determine the number of iterations required for convergence?

The number of iterations for convergence varies depending on the application. The learning curve provides insights into how quickly the cost J decreases over time, allowing users to estimate the appropriate number of iterations for their specific model.

### Q: What is an alternative method for determining convergence?

An automatic convergence test can be used by setting a small threshold Epsilon. If the cost J decreases by less than Epsilon in one iteration, it indicates that the algorithm has reached a flattened part of the learning curve and can declare convergence.

## Summary & Key Takeaways

• Gradient descent aims to find optimal parameters by minimizing the cost function J.

• Plotting the cost function J at each iteration helps visualize the convergence of gradient descent.

• A learning curve shows how the cost J changes after each iteration, helping to identify convergence and determine when to stop training.