Exploring Underfitting in Depth
In this lesson, we'll dive deeper into underfitting
.
Underfitting happens when a model fails to learn the patterns in the training data, leading to poor performance on both training and new data.
Understanding Underfitting Figuratively
Imagine a child starting to learn about dinosaurs.
Initially, when they hear the word Tyrannosaurus
, they only associate it with a large animal with big teeth that walks on two legs
.
If you show the child several dinosaur pictures and ask, Pick out the Tyrannosaurus, they might not choose correctly if they haven’t learned enough.
This shows the child hasn’t learned enough to properly distinguish between dinosaurs. This situation is what we call underfitting
.
Solutions to Underfitting
There are several ways to address underfitting:
1. Increase Model Complexity
Increase the model’s complexity to better capture the patterns in the data. For example, use a model with more features or a more structured neural network.
2. Adjust Hyperparameters
Adjusting hyperparameters can help resolve underfitting as follows:
Learning Rate
Adjust the learning rate to ensure the model can learn effectively.
A learning rate that’s too high can make learning unstable, while one that’s too low may lead to underfitting.
Batch Size
Set the batch size so the model can learn the patterns properly.
A batch size that's too small can make the learning unstable, but if it's too large, underfitting may result.
Number of Epochs
Increase the number of epochs so the model can learn effectively.
Too few epochs can lead to underfitting.
We've now discussed the concept of underfitting and some solutions.
In the next lesson, we'll wrap up what we've learned with a simple quiz.
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.