Overfitting , Underfitting Bias & Variance Understanding by CHIRAG
What is Overfitting?
- High variance(High Test Error) .
- Low Bias(Low Training Error).
- The model is too complex.
- The size of the training data.
What is Bias?
Bias is the difference between the average prediction of our model and the correct value which we are trying to predict. A model with high bias pays very little attention to the training data and oversimplifies the model.
Let’s assume we have trained the model and are trying to predict values with input ‘x_train’. The predicted values are y_predicted.Bias is the error rate of y_predicted and y_train.
In simple terms.
think of bias as the error rate of the training data.
When the error rate is high, we call it High Bias and when the error rate is low, we call it Low Bias
What is a Variance?
Variance is the variability of model prediction for a given data point or a value that tells us the spread of our data. A model with high variance pays a lot of attention to training data and does not generalize on the data which it hasn’t seen before.
Let’s assume we have trained the model and this time we are trying to predict values with input ‘x_test’. Again, the predicted values are y_predicted.Variance is the error rate of the y_predicted and y_test
In simple terms,
think of variance as the error rate of the testing data.
When the error rate is high, we call it High Variance and when the error rate is low, we call it Low Variance.
Techniques to Reduce Overfitting
- Increase training data.
- Reduce model complexity.
- Early stopping during the training phase (have an eye over the loss over the training period as soon as loss begins to increase stop training).
- Ridge Regularization and Lasso Regularization.
- Use dropout for neural networks to tackle overfitting.
What is Underfitting?
- Increase model complexity.
- Increase the number of features, performing feature engineering.
- Remove noise from the data.
- Increase the number of epochs or increase the duration of training to get better results.
A Balanced model will have low bias and low variance.
Let’s take 3 examples to understand Overfitting, Underfitting and Balanced Model.
A model with training error : 2% and test error : 20%
Less Training Error — Low Bias
High Test Error — High Variance
This is an Overfitted Model.A model with training error : 30% and test error : 30%
High Training Error — High Bias
High Test Error — High Variance
This is an Underfitted model.A model with training error : 4% and test error : 3%
Less Training Error — Low Bias
Less Test Error — Low Variance
This is a Balanced model.
Why Bias Variance Tradeoff?
If our model is too simple and has very few parameters then it may have high bias and low variance. On the other hand if our model has large number of parameters then it’s going to have high variance and low bias. So we need to find the right/good balance without overfitting and underfitting the data.
This tradeoff in complexity is why there is a tradeoff between bias and variance. An algorithm can’t be more complex and less complex at the same time.
Total Error
To build a good model, we need to find a good balance between bias and variance such that it minimizes the total error.
Total Error = Bias^2 + Variance+ Irreductable Error
An optimal balance of bias and variance would never overfit or underfit the model.
Therefore understanding bias and variance is critical for understanding the behavior of prediction models.
========================================================================
I Hope you guys like it, stay connected to my next article.
Thank You








Comments
Post a Comment