SlideShare a Scribd company logo
Machine Learning
Lecture2 (Training and Testing, Overfitting and Underfitting)
Training data vs Testing data
• There are two key types of data used for machine learning
training and testing data.
• They each have a specific function to perform when building
and evaluating machine learning models.
• Machine learning algorithms are used to learn from data in
datasets.
• They discover patterns and gain knowledge, make choice
and examine those decisions.
Training and Testing Phases
• Training Phase: The stage where a model learns from data
to recognize patterns.
• Testing Phase: The stage where the model's accuracy is
evaluated using new data.
• We understand this with a generalized Model.
• Lets take a small dataset to understand this concept.
Lecture2_machine learning training+testing.pptx
Training Phase
• Feed features (X) and target (X’) into the model
• Model learns patterns and relationships between X and X’
• Output: A trained model capable of making predictions
• Example: A teacher teaching students by providing
examples and explanations
• To Minimize errors during training to build a reliable model
Testing Phase
• Its purpose is to evaluate model accuracy with new/unseen
data/
• Provide only features (X) to the model.
• Model generates predicted data.
• Compare predicted outputs with actual outputs (Y)
• The difference between predicted and actual values is called
Error Margin.
• A lower error margin indicates a more accurate model.
Difference between Training data and Testing data
Features Training Data Testing Data
Purpose The machine-learning model is trained
using training data. The more training
data a model has, the more accurate
predictions it can make.
Testing data is used to evaluate the
model's performance.
Exposure By using the training data, the model
can gain knowledge and become more
accurate in its predictions.
Until evaluation, the testing data is not
exposed to the model. This guarantees
that the model cannot learn the testing
data by heart and produce flawless
forecasts.
Distribution This training data distribution should
be similar to the distribution of actual
data that the model will use.
The distribution of the testing data and
the data from the real world differs
greatly.
Use To stop overfitting, training data is
utilized.
By making predictions on the testing
data and comparing them to the actual
labels, the performance of the model is
Underfitting and Overfitting
• Machine learning models aim to perform well on both
training data and new unseen data and is considered “good”
if:
1. It learns patterns effectively from the training data.
2. It generalizes well to new, unseen data.
3. It avoids memorizing the training data (overfitting) or
failing to capture relevant patterns (underfitting).
Underfitting in Machine Learning
Underfitting is the opposite of overfitting. It happens when a
model is too simple to capture what’s going on in the data.
• For example, imagine drawing a straight line to fit points
that actually follow a curve. The line misses most of the
pattern.
• In this case, the model doesn’t work well on either the
training or testing data.
• Underfitting models are like students who don’t study
enough. They don’t do well in practice tests or real exams
Sphere
Ball
Orange
Overfitting in Machine Learning
Overfitting happens when a model learns too much from the
training data, including details that don’t matter (like noise or
outliers).
• For example, imagine fitting a very complicated curve to a set of
points. The curve will go through every point, but it won’t
represent the actual pattern.
• As a result, the model works great on training data but fails when
tested on new data.
• Overfitting models are like students who memorize answers
instead of understanding the topic. They do well in practice tests
(training) but struggle in real exams (testing).
Sphere
Play
Can’t Eat
Radius=5cm

More Related Content

PPTX
Underfitting and Overfitting in Machine Learning
PPTX
PPTX
Unit 1-ML (1) (1).pptx
PDF
Machine Learning - Deep Learning
PDF
Introduction to machine learning
PPTX
introduction to machine learning
PPTX
Machine Learning Contents.pptx
PPTX
underfittingandoverfitbnbnbbhhjting.pptx
Underfitting and Overfitting in Machine Learning
Unit 1-ML (1) (1).pptx
Machine Learning - Deep Learning
Introduction to machine learning
introduction to machine learning
Machine Learning Contents.pptx
underfittingandoverfitbnbnbbhhjting.pptx

Similar to Lecture2_machine learning training+testing.pptx (20)

PDF
Machine Learning_Unit 2_Full.ppt.pdf
PPTX
deeplearning topic hashing ppt detailed.pptx
PPTX
10 -- Overfitting and Underfitting.pptx
PPTX
Machine learning with scikitlearn
PPTX
ML2_ML (1) concepts explained in details.pptx
PPTX
Machine learning introduction
PPTX
Statistical Learning and Model Selection module 2.pptx
PPTX
04-Machine-Learning-Overview pros and cons
PPTX
Introduction
PPTX
Introduction
PPTX
Introduction
PPTX
Statistical Machine Learning Lecture notes
PDF
Introduction to Machine Learning concepts
PDF
Machine Learning Basics and Supervised, unsupervised
PDF
Lecture 5
PPTX
Machine learning basics using python programking
PDF
1. Demystifying ML.pdf
PDF
Modelling and evaluation
PPTX
MachineLearning_Unit-I.pptxScrum.pptxAgile Model.pptxAgile Model.pptxAgile Mo...
PPTX
Machine-Learning-Overview a statistical approach
Machine Learning_Unit 2_Full.ppt.pdf
deeplearning topic hashing ppt detailed.pptx
10 -- Overfitting and Underfitting.pptx
Machine learning with scikitlearn
ML2_ML (1) concepts explained in details.pptx
Machine learning introduction
Statistical Learning and Model Selection module 2.pptx
04-Machine-Learning-Overview pros and cons
Introduction
Introduction
Introduction
Statistical Machine Learning Lecture notes
Introduction to Machine Learning concepts
Machine Learning Basics and Supervised, unsupervised
Lecture 5
Machine learning basics using python programking
1. Demystifying ML.pdf
Modelling and evaluation
MachineLearning_Unit-I.pptxScrum.pptxAgile Model.pptxAgile Model.pptxAgile Mo...
Machine-Learning-Overview a statistical approach
Ad

More from MuhammadAfzaal327724 (20)

PPTX
Lecture4_machine learning Principle .pptx
PPT
lec_2_EE_communication system lecture number 2.ppt
PPT
communication system lecture 1 slides .ppt
PPTX
Internet_of_Things_Presentation_slides.pptx
PPTX
Ethics_in_AI_Presentation_slides_new.pptx
PPTX
Blockchain_Technology_Presentation_more_slides.pptx
PPTX
Ethics_in_AI_Presentation_ethics_ai.pptx
PPTX
Blockchain_Technology_Presentation_ai.pptx
PPTX
Ethics_in_AI_Presentation_ethics_ai.pptx
PPTX
Blockchain_Technology_Presentation_slides.pptx
PPTX
Climate_Change_Global_Impact_Presentation.pptx
PPTX
Cybersecurity_Modern_World_Presentation.pptx
PPTX
AI_in_Daily_Life_Presentation_slides.pptx
PPTX
Internet_of_Things_Presentation_slides.pptx
PPTX
Product_Specifications_and_Features_2025Spring_v1.pptx
PPT
3_JumpAndCall_v21_presenatationb also.ppt
PPTX
Presentation real time system slides.pptx
PPTX
PresentationGraphs and its theory.ppt.pptx
PPTX
Presentation1_presentation for discrete structures.pptx
PPTX
Chap-3_A+Reference+Model+of+Real-Time+Systems.pptx
Lecture4_machine learning Principle .pptx
lec_2_EE_communication system lecture number 2.ppt
communication system lecture 1 slides .ppt
Internet_of_Things_Presentation_slides.pptx
Ethics_in_AI_Presentation_slides_new.pptx
Blockchain_Technology_Presentation_more_slides.pptx
Ethics_in_AI_Presentation_ethics_ai.pptx
Blockchain_Technology_Presentation_ai.pptx
Ethics_in_AI_Presentation_ethics_ai.pptx
Blockchain_Technology_Presentation_slides.pptx
Climate_Change_Global_Impact_Presentation.pptx
Cybersecurity_Modern_World_Presentation.pptx
AI_in_Daily_Life_Presentation_slides.pptx
Internet_of_Things_Presentation_slides.pptx
Product_Specifications_and_Features_2025Spring_v1.pptx
3_JumpAndCall_v21_presenatationb also.ppt
Presentation real time system slides.pptx
PresentationGraphs and its theory.ppt.pptx
Presentation1_presentation for discrete structures.pptx
Chap-3_A+Reference+Model+of+Real-Time+Systems.pptx
Ad

Recently uploaded (20)

PDF
Todays Technician Automotive Heating & Air Conditioning Classroom Manual and ...
PDF
EC300D LR EC300DLR - Volvo Service Repair Manual.pdf
PDF
Caterpillar Cat 315C Excavator (Prefix ANF) Service Repair Manual Instant Dow...
PDF
Volvo EC290C NL EC290CNL Excavator Service Repair Manual Instant Download.pdf
PPT
Mettal aloys and it's application and theri composition
PDF
Volvo EC20C Excavator Step-by-step Maintenance Instructions pdf
PDF
Volvo EC300D L EC300DL excavator weight Manuals.pdf
PDF
Volvo EC20C Excavator Service maintenance schedules.pdf
PDF
Journal Meraj.pdfuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
PPTX
Type of Sentence & SaaaaaaaaaadddVA.pptx
PPTX
Lecture 3b C Library xnxjxjxjxkx_ ESP32.pptx
PDF
Volvo EC290C NL EC290CNL excavator weight.pdf
PPTX
Gayatri Cultural Educational Society.pptx
PPTX
Zeem: Transition Your Fleet, Seamlessly by Margaret Boelter
PPTX
UNIT-2(B) Organisavtional Appraisal.pptx
PDF
Caterpillar CAT 311B EXCAVATOR (8GR00001-UP) Operation and Maintenance Manual...
PDF
How Much does a Volvo EC290C NL EC290CNL Weight.pdf
PPTX
Fire Fighting Unit IV industrial safety.pptx
PDF
Physics class 12thstep down transformer project.pdf
PDF
MANDIBLE (1).pdffawffffffffffffffffffffffffffffffffffffffffff
Todays Technician Automotive Heating & Air Conditioning Classroom Manual and ...
EC300D LR EC300DLR - Volvo Service Repair Manual.pdf
Caterpillar Cat 315C Excavator (Prefix ANF) Service Repair Manual Instant Dow...
Volvo EC290C NL EC290CNL Excavator Service Repair Manual Instant Download.pdf
Mettal aloys and it's application and theri composition
Volvo EC20C Excavator Step-by-step Maintenance Instructions pdf
Volvo EC300D L EC300DL excavator weight Manuals.pdf
Volvo EC20C Excavator Service maintenance schedules.pdf
Journal Meraj.pdfuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
Type of Sentence & SaaaaaaaaaadddVA.pptx
Lecture 3b C Library xnxjxjxjxkx_ ESP32.pptx
Volvo EC290C NL EC290CNL excavator weight.pdf
Gayatri Cultural Educational Society.pptx
Zeem: Transition Your Fleet, Seamlessly by Margaret Boelter
UNIT-2(B) Organisavtional Appraisal.pptx
Caterpillar CAT 311B EXCAVATOR (8GR00001-UP) Operation and Maintenance Manual...
How Much does a Volvo EC290C NL EC290CNL Weight.pdf
Fire Fighting Unit IV industrial safety.pptx
Physics class 12thstep down transformer project.pdf
MANDIBLE (1).pdffawffffffffffffffffffffffffffffffffffffffffff

Lecture2_machine learning training+testing.pptx

  • 1. Machine Learning Lecture2 (Training and Testing, Overfitting and Underfitting)
  • 2. Training data vs Testing data • There are two key types of data used for machine learning training and testing data. • They each have a specific function to perform when building and evaluating machine learning models. • Machine learning algorithms are used to learn from data in datasets. • They discover patterns and gain knowledge, make choice and examine those decisions.
  • 3. Training and Testing Phases • Training Phase: The stage where a model learns from data to recognize patterns. • Testing Phase: The stage where the model's accuracy is evaluated using new data. • We understand this with a generalized Model. • Lets take a small dataset to understand this concept.
  • 5. Training Phase • Feed features (X) and target (X’) into the model • Model learns patterns and relationships between X and X’ • Output: A trained model capable of making predictions • Example: A teacher teaching students by providing examples and explanations • To Minimize errors during training to build a reliable model
  • 6. Testing Phase • Its purpose is to evaluate model accuracy with new/unseen data/ • Provide only features (X) to the model. • Model generates predicted data. • Compare predicted outputs with actual outputs (Y) • The difference between predicted and actual values is called Error Margin. • A lower error margin indicates a more accurate model.
  • 7. Difference between Training data and Testing data Features Training Data Testing Data Purpose The machine-learning model is trained using training data. The more training data a model has, the more accurate predictions it can make. Testing data is used to evaluate the model's performance. Exposure By using the training data, the model can gain knowledge and become more accurate in its predictions. Until evaluation, the testing data is not exposed to the model. This guarantees that the model cannot learn the testing data by heart and produce flawless forecasts. Distribution This training data distribution should be similar to the distribution of actual data that the model will use. The distribution of the testing data and the data from the real world differs greatly. Use To stop overfitting, training data is utilized. By making predictions on the testing data and comparing them to the actual labels, the performance of the model is
  • 8. Underfitting and Overfitting • Machine learning models aim to perform well on both training data and new unseen data and is considered “good” if: 1. It learns patterns effectively from the training data. 2. It generalizes well to new, unseen data. 3. It avoids memorizing the training data (overfitting) or failing to capture relevant patterns (underfitting).
  • 9. Underfitting in Machine Learning Underfitting is the opposite of overfitting. It happens when a model is too simple to capture what’s going on in the data. • For example, imagine drawing a straight line to fit points that actually follow a curve. The line misses most of the pattern. • In this case, the model doesn’t work well on either the training or testing data. • Underfitting models are like students who don’t study enough. They don’t do well in practice tests or real exams
  • 11. Overfitting in Machine Learning Overfitting happens when a model learns too much from the training data, including details that don’t matter (like noise or outliers). • For example, imagine fitting a very complicated curve to a set of points. The curve will go through every point, but it won’t represent the actual pattern. • As a result, the model works great on training data but fails when tested on new data. • Overfitting models are like students who memorize answers instead of understanding the topic. They do well in practice tests (training) but struggle in real exams (testing).