Overfitting and
Underfitting in Machine
Learning
Overfitting in machine learning
 Overfitting refers to a scenario when the model tries to cover all the data points present
in the given dataset.
 The model starts caching noise and inaccurate values present in the dataset.
 Reduces the efficiency and accuracy of the model.
 The overfitted model has low bias and high variance
Overfitting in machine learning Cont.
Reasons for Overfitting
Overfitting in machine learning Cont.
Overfitted model performance
 The accuracy score is good and high during training but it decreases during testing.
How to avoid Overfitting
 Using cross-validation
 Using Regularization techniques
 Implementing Ensembling techniques.
 Picking a less parameterized/complex model
 Training the model with sufficient data
 Removing features
 Early stopping the training
Underfitting in machine learning
 Underfitting is just the opposite of overfitting.
 Underfitting occurs when our machine learning model is not able to capture the
underlying trend of the data.
 An underfitted model has high bias and low variance.
Underfitting in machine learning Cont.
Reasons for Underfitting
Underfitting in machine learning Cont.
Underfitted model performance
 The accuracy score is low during training as well as testing.
How to avoid Underfitting
 Preprocessing the data to reduce noise in data
 More training to the model
 Increasing the number of features in the dataset
 Increasing the model complexity
 Increasing the training time of the model to get better results.
Good fit model in machine learning
 A good fit model is a balanced model, which is not suffering from underfitting and
overfitting.
 This is a perfect model which gives good accuracy score during training and equally
performs well during testing.
Detecting Overfitting And Underfitting
And Good Fit
Detecting for Classification and Regression:
Error Overfitting Right Fit Underfitting
Training Low Low High
Test High Low High
Comparison between Overfitting and
Underfitting VS. Good Fit in a Model
Example To Understand Overfitting vs. Underfitting
(vs. Good Fitting) in Machine Learning
 Consider a AI class consisting of students and a professor
Example To Underfitting vs. Overfitting (vs. Best
Fitting) in Machine Learning Cont.
 We can broadly divide the students into 3 features (Hobby, Interest, Attention).
Example To Underfitting vs. Overfitting (vs. Best
Fitting) in Machine Learning Cont.
 The professor first delivers lectures and teaches the students about the problems and
how to solve them.
 At the end of the day, the professor simply takes a quiz based on what he taught in
the class.
Example To Underfitting vs. Overfitting (vs. Best
Fitting) in Machine Learning Cont.
 So, let’s discuss what happens when the professor takes a classroom test at the end of
the day:
 We can clearly infer that the student who simply memorizes everything is scoring better without
much difficulty.
Example To Underfitting vs. Overfitting (vs. Best
Fitting) in Machine Learning Cont.
 Now here’s the twist.
 Let’s also look at what happens during the semester final, when students have to face
new unknown questions which are not taught in the class by the Professor.
How Does this Relate to Underfitting and
Overfitting in Machine Learning
 Summaries the students Class Test and Semester Exam scores with a feature of
Interest.
 We Make a dataset with Class Test and Semester Exam scores as a training and testing
dataset.
How Does this Relate to Underfitting and
Overfitting in Machine Learning
 This example relates to the problem dataset Which the train, test and validation
scores of the dataset.
 This example relates to the problem Which we encountered during the train and test
scores of the decision tree classifier.
How Does this Relate to Underfitting and Overfitting
in Machine Learning Cont.
 Let’s work on connecting this example with the results of the decision tree classifier.
References
 https://www.javatpoint.com/
 https://www.shiksha.com/
 https://www.analyticsvidhya.com/
 https://www.baeldung.com/
 https://www.geeksforgeeks.org/
Thank You

Underfitting and Overfitting in Machine Learning

  • 1.
  • 2.
    Overfitting in machinelearning  Overfitting refers to a scenario when the model tries to cover all the data points present in the given dataset.  The model starts caching noise and inaccurate values present in the dataset.  Reduces the efficiency and accuracy of the model.  The overfitted model has low bias and high variance
  • 3.
    Overfitting in machinelearning Cont. Reasons for Overfitting
  • 4.
    Overfitting in machinelearning Cont. Overfitted model performance  The accuracy score is good and high during training but it decreases during testing. How to avoid Overfitting  Using cross-validation  Using Regularization techniques  Implementing Ensembling techniques.  Picking a less parameterized/complex model  Training the model with sufficient data  Removing features  Early stopping the training
  • 5.
    Underfitting in machinelearning  Underfitting is just the opposite of overfitting.  Underfitting occurs when our machine learning model is not able to capture the underlying trend of the data.  An underfitted model has high bias and low variance.
  • 6.
    Underfitting in machinelearning Cont. Reasons for Underfitting
  • 7.
    Underfitting in machinelearning Cont. Underfitted model performance  The accuracy score is low during training as well as testing. How to avoid Underfitting  Preprocessing the data to reduce noise in data  More training to the model  Increasing the number of features in the dataset  Increasing the model complexity  Increasing the training time of the model to get better results.
  • 8.
    Good fit modelin machine learning  A good fit model is a balanced model, which is not suffering from underfitting and overfitting.  This is a perfect model which gives good accuracy score during training and equally performs well during testing.
  • 9.
    Detecting Overfitting AndUnderfitting And Good Fit Detecting for Classification and Regression: Error Overfitting Right Fit Underfitting Training Low Low High Test High Low High
  • 10.
    Comparison between Overfittingand Underfitting VS. Good Fit in a Model
  • 11.
    Example To UnderstandOverfitting vs. Underfitting (vs. Good Fitting) in Machine Learning  Consider a AI class consisting of students and a professor
  • 12.
    Example To Underfittingvs. Overfitting (vs. Best Fitting) in Machine Learning Cont.  We can broadly divide the students into 3 features (Hobby, Interest, Attention).
  • 13.
    Example To Underfittingvs. Overfitting (vs. Best Fitting) in Machine Learning Cont.  The professor first delivers lectures and teaches the students about the problems and how to solve them.  At the end of the day, the professor simply takes a quiz based on what he taught in the class.
  • 14.
    Example To Underfittingvs. Overfitting (vs. Best Fitting) in Machine Learning Cont.  So, let’s discuss what happens when the professor takes a classroom test at the end of the day:  We can clearly infer that the student who simply memorizes everything is scoring better without much difficulty.
  • 15.
    Example To Underfittingvs. Overfitting (vs. Best Fitting) in Machine Learning Cont.  Now here’s the twist.  Let’s also look at what happens during the semester final, when students have to face new unknown questions which are not taught in the class by the Professor.
  • 16.
    How Does thisRelate to Underfitting and Overfitting in Machine Learning  Summaries the students Class Test and Semester Exam scores with a feature of Interest.  We Make a dataset with Class Test and Semester Exam scores as a training and testing dataset.
  • 17.
    How Does thisRelate to Underfitting and Overfitting in Machine Learning  This example relates to the problem dataset Which the train, test and validation scores of the dataset.  This example relates to the problem Which we encountered during the train and test scores of the decision tree classifier.
  • 18.
    How Does thisRelate to Underfitting and Overfitting in Machine Learning Cont.  Let’s work on connecting this example with the results of the decision tree classifier.
  • 19.
    References  https://www.javatpoint.com/  https://www.shiksha.com/ https://www.analyticsvidhya.com/  https://www.baeldung.com/  https://www.geeksforgeeks.org/
  • 20.