SlideShare a Scribd company logo
Data Science
Model Performance Metrics
(F1 score, AUC, Confusion Matrix)
F1-Score
The F1 score is a metric used to evaluate the performance of a classification
model, especially when dealing with imbalanced classes. It's the harmonic
mean of precision and recall, providing a balance between the two.
The formula for the F1 score is:
F1= 2 x (Precision x Recall / Precision + Recall)
F1 score could be an effective evaluation metric when FP and FN are
equally costly.
Example
Suppose we have a binary classification problem where we want to predict
whether emails are spam (positive class) or not spam (negative class).
• True Positives (TP) = 90 False Positives (FP) = 10
• False Negatives (FN) = 15 True Negatives (TN) = 885
• Precision = 90/90+10 = 0.9
• Recall= 90/90+15 = 0.857
• F1 Score= 2 x (0.9 x 0.857 / 0.9+0.857) = 0.878
The F1 score for this classification model is approximately 0.878. It
provides a single metric that considers both precision and recall, making it
useful for evaluating the model's overall performance, especially in
scenarios with imbalanced classes.
ROC Curve and AUC
The Receiver Operating Characteristic (ROC) curve and the Area Under the
ROC Curve (AUC) are widely used evaluation metrics for binary
classification models.
They are particularly useful when dealing with imbalanced datasets or when
the cost of false positives and false negatives varies.
ROC curve
• The ROC curve is a graphical representation of the trade-off between the
true positive rate (sensitivity) and the false positive rate (1 - specificity)
for different threshold values.
• The true positive rate (TPR) is the ratio of true positive predictions to the
total actual positive instances in the dataset. It represents the model's
ability to correctly identify positive instances.
• The false positive rate (FPR) is the ratio of false positive predictions to
the total actual negative instances in the dataset. It represents the model's
tendency to incorrectly identify negative instances as positive.
ROC curve
• The ROC curve plots the TPR against the FPR as the discrimination
threshold is varied from 0 to 1. Each point on the curve represents a
different threshold, and the curve illustrates how the model's performance
changes across various threshold values.
• A diagonal line from the bottom-left corner to the top-right corner
represents random guessing (an ineffective model). A good model's ROC
curve will be closer to the top-left corner, indicating high TPR and low
FPR across different thresholds.
AUC (Area under the ROC curve)
• The AUC quantifies the overall performance of a classification model by
calculating the area under the ROC curve.
• A perfect classifier would have an AUC of 1, indicating that it achieves a
TPR of 1 (identifies all positives correctly) while maintaining an FPR of
0 (makes no false positive predictions).
• A random classifier would have an AUC of 0.5, as the ROC curve would
be a diagonal line from (0,0) to (1,1).
• The AUC provides a single scalar value that summarizes the model's
performance across all possible classification thresholds. Higher AUC
values indicate better overall performance, with values closer to 1
indicating better discrimination between positive and negative instances.
AUC (Area under the ROC curve)
• Generally, an AUC above 0.8 is considered good, while an AUC above
0.9 is considered excellent. An AUC below 0.7 might indicate poor
discriminatory power.
Confusion Matrix
A confusion matrix is a table that is often used to evaluate the performance
of a classification model. It provides a comprehensive summary of the
model's predictions compared to the actual outcomes in a tabular format.
Each row of the matrix represents the instances in a predicted class, while
each column represents the instances in an actual class.
Predicted Actual
Positive Negative
Positive (P) True Positive False Positive
Negative (N) False Negative True Negative
Components of confusion matrix
True Positives (TP): These are the cases where the model correctly predicts
the positive class. For example, in a medical diagnosis scenario, TP would
represent the number of patients correctly diagnosed with a disease.
False Positives (FP): These are the cases where the model incorrectly
predicts the positive class when it's actually negative. In medical terms, FP
would represent healthy patients incorrectly diagnosed with a disease.
False Negatives (FN): These are the cases where the model
incorrectly predicts the negative class when it's actually positive. In
medical terms, FN would represent patients with a disease incorrectly
classified as healthy.
Components of confusion matrix
True Negatives (TN): These are the cases where the model correctly
predicts the negative class. For example, in a medical diagnosis scenario,
TN would represent the number of healthy patients correctly identified as
such.
The confusion matrix is a valuable tool for understanding the strengths and
weaknesses of a classification model, particularly in scenarios with
imbalanced classes or when certain types of errors (e.g., false positives or
false negatives) are more costly or critical than others.
Please check the description box for the link to Machine Learning videos.
Evaluating model for Imbalanced datasets
When dealing with imbalanced datasets in classification tasks, where the
number of instances in one class significantly outweighs the other, standard
evaluation metrics like accuracy can be misleading.
strategies for effectively evaluating models trained on imbalanced datasets
 Confusion Matrix
Precision, Recall and F1 Score
ROC curve and AUC
Ensemble methods
Resampling techniques: oversampling the minority class or under
sampling the majority class to balance the dataset before evaluation. Use
stratified sampling when splitting the dataset into training and testing sets
to ensure that the class distribution remains consistent across both sets.
Thanks for Watching!
Please check the description box for the link to
Machine Learning videos.

More Related Content

Similar to Model Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUC

Assessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's GuideAssessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's Guide
Megan Verbakel
 
Introduction to ROC Curve Analysis with Application in Functional Genomics
Introduction to ROC Curve Analysis with Application in Functional GenomicsIntroduction to ROC Curve Analysis with Application in Functional Genomics
Introduction to ROC Curve Analysis with Application in Functional Genomics
Shana White
 
Model Evaluation Matrix: Accuracy, precision and recall
Model Evaluation Matrix: Accuracy, precision and recallModel Evaluation Matrix: Accuracy, precision and recall
Model Evaluation Matrix: Accuracy, precision and recall
Megha Sharma
 
Classification assessment methods
Classification assessment methodsClassification assessment methods
Classification assessment methods
Alaa Tharwat
 
Classification Assessment Methods.pptx
Classification Assessment  Methods.pptxClassification Assessment  Methods.pptx
Classification Assessment Methods.pptx
Riadh Al-Haidari
 
PERFORMANCE_PREDICTION__PARAMETERS[1].pptx
PERFORMANCE_PREDICTION__PARAMETERS[1].pptxPERFORMANCE_PREDICTION__PARAMETERS[1].pptx
PERFORMANCE_PREDICTION__PARAMETERS[1].pptx
TAHIRZAMAN81
 
All PERFORMANCE PREDICTION PARAMETERS.pptx
All PERFORMANCE PREDICTION  PARAMETERS.pptxAll PERFORMANCE PREDICTION  PARAMETERS.pptx
All PERFORMANCE PREDICTION PARAMETERS.pptx
taherzamanrather
 
Machine learning session4(linear regression)
Machine learning   session4(linear regression)Machine learning   session4(linear regression)
Machine learning session4(linear regression)
Abhimanyu Dwivedi
 
Evaluation measures for models assessment over imbalanced data sets
Evaluation measures for models assessment over imbalanced data setsEvaluation measures for models assessment over imbalanced data sets
Evaluation measures for models assessment over imbalanced data sets
Alexander Decker
 
Confusion matrix and classification evaluation metrics
Confusion matrix and classification evaluation metricsConfusion matrix and classification evaluation metrics
Confusion matrix and classification evaluation metrics
Minesh A. Jethva
 
Ways to evaluate a machine learning model’s performance
Ways to evaluate a machine learning model’s performanceWays to evaluate a machine learning model’s performance
Ways to evaluate a machine learning model’s performance
Mala Deep Upadhaya
 
modelperfcheatsheet.pdf
modelperfcheatsheet.pdfmodelperfcheatsheet.pdf
modelperfcheatsheet.pdf
ERNESTOVEIGA
 
Parametric & non parametric
Parametric & non parametricParametric & non parametric
Parametric & non parametric
ANCYBS
 
Excel Files AssingmentsCopy of Student_Assignment_File.11.01..docx
Excel Files AssingmentsCopy of Student_Assignment_File.11.01..docxExcel Files AssingmentsCopy of Student_Assignment_File.11.01..docx
Excel Files AssingmentsCopy of Student_Assignment_File.11.01..docx
SANSKAR20
 
A.5 est pop param and me
A.5 est pop param and meA.5 est pop param and me
A.5 est pop param and meUlster BOCES
 
ROC CURVE AND ANALYSIS.pptx
ROC CURVE AND ANALYSIS.pptxROC CURVE AND ANALYSIS.pptx
ROC CURVE AND ANALYSIS.pptx
agniva pradhan
 
working with python
working with pythonworking with python
working with python
bhavesh lande
 
Quantitative Data analysis
Quantitative Data analysisQuantitative Data analysis
Quantitative Data analysis
Muhammad Musawar Ali
 
1. Outline the differences between Hoarding power and Encouraging..docx
1. Outline the differences between Hoarding power and Encouraging..docx1. Outline the differences between Hoarding power and Encouraging..docx
1. Outline the differences between Hoarding power and Encouraging..docx
paynetawnya
 
Week 5 Lecture 14 The Chi Square Test Quite often, pat.docx
Week 5 Lecture 14 The Chi Square Test Quite often, pat.docxWeek 5 Lecture 14 The Chi Square Test Quite often, pat.docx
Week 5 Lecture 14 The Chi Square Test Quite often, pat.docx
cockekeshia
 

Similar to Model Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUC (20)

Assessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's GuideAssessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's Guide
 
Introduction to ROC Curve Analysis with Application in Functional Genomics
Introduction to ROC Curve Analysis with Application in Functional GenomicsIntroduction to ROC Curve Analysis with Application in Functional Genomics
Introduction to ROC Curve Analysis with Application in Functional Genomics
 
Model Evaluation Matrix: Accuracy, precision and recall
Model Evaluation Matrix: Accuracy, precision and recallModel Evaluation Matrix: Accuracy, precision and recall
Model Evaluation Matrix: Accuracy, precision and recall
 
Classification assessment methods
Classification assessment methodsClassification assessment methods
Classification assessment methods
 
Classification Assessment Methods.pptx
Classification Assessment  Methods.pptxClassification Assessment  Methods.pptx
Classification Assessment Methods.pptx
 
PERFORMANCE_PREDICTION__PARAMETERS[1].pptx
PERFORMANCE_PREDICTION__PARAMETERS[1].pptxPERFORMANCE_PREDICTION__PARAMETERS[1].pptx
PERFORMANCE_PREDICTION__PARAMETERS[1].pptx
 
All PERFORMANCE PREDICTION PARAMETERS.pptx
All PERFORMANCE PREDICTION  PARAMETERS.pptxAll PERFORMANCE PREDICTION  PARAMETERS.pptx
All PERFORMANCE PREDICTION PARAMETERS.pptx
 
Machine learning session4(linear regression)
Machine learning   session4(linear regression)Machine learning   session4(linear regression)
Machine learning session4(linear regression)
 
Evaluation measures for models assessment over imbalanced data sets
Evaluation measures for models assessment over imbalanced data setsEvaluation measures for models assessment over imbalanced data sets
Evaluation measures for models assessment over imbalanced data sets
 
Confusion matrix and classification evaluation metrics
Confusion matrix and classification evaluation metricsConfusion matrix and classification evaluation metrics
Confusion matrix and classification evaluation metrics
 
Ways to evaluate a machine learning model’s performance
Ways to evaluate a machine learning model’s performanceWays to evaluate a machine learning model’s performance
Ways to evaluate a machine learning model’s performance
 
modelperfcheatsheet.pdf
modelperfcheatsheet.pdfmodelperfcheatsheet.pdf
modelperfcheatsheet.pdf
 
Parametric & non parametric
Parametric & non parametricParametric & non parametric
Parametric & non parametric
 
Excel Files AssingmentsCopy of Student_Assignment_File.11.01..docx
Excel Files AssingmentsCopy of Student_Assignment_File.11.01..docxExcel Files AssingmentsCopy of Student_Assignment_File.11.01..docx
Excel Files AssingmentsCopy of Student_Assignment_File.11.01..docx
 
A.5 est pop param and me
A.5 est pop param and meA.5 est pop param and me
A.5 est pop param and me
 
ROC CURVE AND ANALYSIS.pptx
ROC CURVE AND ANALYSIS.pptxROC CURVE AND ANALYSIS.pptx
ROC CURVE AND ANALYSIS.pptx
 
working with python
working with pythonworking with python
working with python
 
Quantitative Data analysis
Quantitative Data analysisQuantitative Data analysis
Quantitative Data analysis
 
1. Outline the differences between Hoarding power and Encouraging..docx
1. Outline the differences between Hoarding power and Encouraging..docx1. Outline the differences between Hoarding power and Encouraging..docx
1. Outline the differences between Hoarding power and Encouraging..docx
 
Week 5 Lecture 14 The Chi Square Test Quite often, pat.docx
Week 5 Lecture 14 The Chi Square Test Quite often, pat.docxWeek 5 Lecture 14 The Chi Square Test Quite often, pat.docx
Week 5 Lecture 14 The Chi Square Test Quite often, pat.docx
 

More from Megha Sharma

Data Management Activities, Extraction, Transformation and Loading (ETL)
Data Management Activities, Extraction, Transformation and Loading (ETL)Data Management Activities, Extraction, Transformation and Loading (ETL)
Data Management Activities, Extraction, Transformation and Loading (ETL)
Megha Sharma
 
Descriptive Statistics: Mean, Median Mode and Standard Deviation.
Descriptive Statistics: Mean, Median Mode and Standard Deviation.Descriptive Statistics: Mean, Median Mode and Standard Deviation.
Descriptive Statistics: Mean, Median Mode and Standard Deviation.
Megha Sharma
 
Visualization Techniques- Box plot, Line Chart, Scatter plot, Bar chart.
Visualization Techniques- Box plot, Line Chart, Scatter plot, Bar chart.Visualization Techniques- Box plot, Line Chart, Scatter plot, Bar chart.
Visualization Techniques- Box plot, Line Chart, Scatter plot, Bar chart.
Megha Sharma
 
Visualization Techniques ,Exploratory Data Analysis(EDA), Histogram
Visualization Techniques ,Exploratory Data Analysis(EDA), HistogramVisualization Techniques ,Exploratory Data Analysis(EDA), Histogram
Visualization Techniques ,Exploratory Data Analysis(EDA), Histogram
Megha Sharma
 
Data Preprocessing- Data transformation, Scaling, Normalization, Standardiza...
Data Preprocessing- Data transformation,  Scaling, Normalization, Standardiza...Data Preprocessing- Data transformation,  Scaling, Normalization, Standardiza...
Data Preprocessing- Data transformation, Scaling, Normalization, Standardiza...
Megha Sharma
 
Data Science- Data Preprocessing, Data Cleaning.
Data Science- Data Preprocessing, Data Cleaning.Data Science- Data Preprocessing, Data Cleaning.
Data Science- Data Preprocessing, Data Cleaning.
Megha Sharma
 
Data Preprocessing- Feature Selection and Merging.
Data Preprocessing- Feature Selection and Merging.Data Preprocessing- Feature Selection and Merging.
Data Preprocessing- Feature Selection and Merging.
Megha Sharma
 
Different types of data. Qualitative, Quantitative, Ordinal, Nominal, Discret...
Different types of data. Qualitative, Quantitative, Ordinal, Nominal, Discret...Different types of data. Qualitative, Quantitative, Ordinal, Nominal, Discret...
Different types of data. Qualitative, Quantitative, Ordinal, Nominal, Discret...
Megha Sharma
 
Data Science comparison with AI, ML, BI, and data warehousing, data mining.
Data Science comparison with AI, ML, BI, and data warehousing, data mining.Data Science comparison with AI, ML, BI, and data warehousing, data mining.
Data Science comparison with AI, ML, BI, and data warehousing, data mining.
Megha Sharma
 
Data Science Introduction, Application of Data Science.
Data Science Introduction, Application of Data Science.Data Science Introduction, Application of Data Science.
Data Science Introduction, Application of Data Science.
Megha Sharma
 
Ensemble learning
Ensemble learningEnsemble learning
Ensemble learning
Megha Sharma
 
Association Rule mining
Association Rule miningAssociation Rule mining
Association Rule mining
Megha Sharma
 
Bellman's equation Reinforcement learning - II
Bellman's equation Reinforcement learning - IIBellman's equation Reinforcement learning - II
Bellman's equation Reinforcement learning - II
Megha Sharma
 
Reinforcement learning in Machine learning
 Reinforcement learning in Machine learning Reinforcement learning in Machine learning
Reinforcement learning in Machine learning
Megha Sharma
 
E-M Algorithm
E-M AlgorithmE-M Algorithm
E-M Algorithm
Megha Sharma
 
Entropy and information gain in decision tree.
Entropy and information gain in decision tree.Entropy and information gain in decision tree.
Entropy and information gain in decision tree.
Megha Sharma
 
Types of Machine Learning. & Decision Tree.
Types of Machine Learning. & Decision Tree.Types of Machine Learning. & Decision Tree.
Types of Machine Learning. & Decision Tree.
Megha Sharma
 
If statements in C
If statements in CIf statements in C
If statements in C
Megha Sharma
 
Conditional and special operators
Conditional and special operatorsConditional and special operators
Conditional and special operators
Megha Sharma
 
Assignment operators
Assignment operatorsAssignment operators
Assignment operators
Megha Sharma
 

More from Megha Sharma (20)

Data Management Activities, Extraction, Transformation and Loading (ETL)
Data Management Activities, Extraction, Transformation and Loading (ETL)Data Management Activities, Extraction, Transformation and Loading (ETL)
Data Management Activities, Extraction, Transformation and Loading (ETL)
 
Descriptive Statistics: Mean, Median Mode and Standard Deviation.
Descriptive Statistics: Mean, Median Mode and Standard Deviation.Descriptive Statistics: Mean, Median Mode and Standard Deviation.
Descriptive Statistics: Mean, Median Mode and Standard Deviation.
 
Visualization Techniques- Box plot, Line Chart, Scatter plot, Bar chart.
Visualization Techniques- Box plot, Line Chart, Scatter plot, Bar chart.Visualization Techniques- Box plot, Line Chart, Scatter plot, Bar chart.
Visualization Techniques- Box plot, Line Chart, Scatter plot, Bar chart.
 
Visualization Techniques ,Exploratory Data Analysis(EDA), Histogram
Visualization Techniques ,Exploratory Data Analysis(EDA), HistogramVisualization Techniques ,Exploratory Data Analysis(EDA), Histogram
Visualization Techniques ,Exploratory Data Analysis(EDA), Histogram
 
Data Preprocessing- Data transformation, Scaling, Normalization, Standardiza...
Data Preprocessing- Data transformation,  Scaling, Normalization, Standardiza...Data Preprocessing- Data transformation,  Scaling, Normalization, Standardiza...
Data Preprocessing- Data transformation, Scaling, Normalization, Standardiza...
 
Data Science- Data Preprocessing, Data Cleaning.
Data Science- Data Preprocessing, Data Cleaning.Data Science- Data Preprocessing, Data Cleaning.
Data Science- Data Preprocessing, Data Cleaning.
 
Data Preprocessing- Feature Selection and Merging.
Data Preprocessing- Feature Selection and Merging.Data Preprocessing- Feature Selection and Merging.
Data Preprocessing- Feature Selection and Merging.
 
Different types of data. Qualitative, Quantitative, Ordinal, Nominal, Discret...
Different types of data. Qualitative, Quantitative, Ordinal, Nominal, Discret...Different types of data. Qualitative, Quantitative, Ordinal, Nominal, Discret...
Different types of data. Qualitative, Quantitative, Ordinal, Nominal, Discret...
 
Data Science comparison with AI, ML, BI, and data warehousing, data mining.
Data Science comparison with AI, ML, BI, and data warehousing, data mining.Data Science comparison with AI, ML, BI, and data warehousing, data mining.
Data Science comparison with AI, ML, BI, and data warehousing, data mining.
 
Data Science Introduction, Application of Data Science.
Data Science Introduction, Application of Data Science.Data Science Introduction, Application of Data Science.
Data Science Introduction, Application of Data Science.
 
Ensemble learning
Ensemble learningEnsemble learning
Ensemble learning
 
Association Rule mining
Association Rule miningAssociation Rule mining
Association Rule mining
 
Bellman's equation Reinforcement learning - II
Bellman's equation Reinforcement learning - IIBellman's equation Reinforcement learning - II
Bellman's equation Reinforcement learning - II
 
Reinforcement learning in Machine learning
 Reinforcement learning in Machine learning Reinforcement learning in Machine learning
Reinforcement learning in Machine learning
 
E-M Algorithm
E-M AlgorithmE-M Algorithm
E-M Algorithm
 
Entropy and information gain in decision tree.
Entropy and information gain in decision tree.Entropy and information gain in decision tree.
Entropy and information gain in decision tree.
 
Types of Machine Learning. & Decision Tree.
Types of Machine Learning. & Decision Tree.Types of Machine Learning. & Decision Tree.
Types of Machine Learning. & Decision Tree.
 
If statements in C
If statements in CIf statements in C
If statements in C
 
Conditional and special operators
Conditional and special operatorsConditional and special operators
Conditional and special operators
 
Assignment operators
Assignment operatorsAssignment operators
Assignment operators
 

Recently uploaded

Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Denish Jangid
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
Nguyen Thanh Tu Collection
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
ricssacare
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 

Recently uploaded (20)

Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 

Model Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUC

  • 1. Data Science Model Performance Metrics (F1 score, AUC, Confusion Matrix)
  • 2. F1-Score The F1 score is a metric used to evaluate the performance of a classification model, especially when dealing with imbalanced classes. It's the harmonic mean of precision and recall, providing a balance between the two. The formula for the F1 score is: F1= 2 x (Precision x Recall / Precision + Recall) F1 score could be an effective evaluation metric when FP and FN are equally costly.
  • 3. Example Suppose we have a binary classification problem where we want to predict whether emails are spam (positive class) or not spam (negative class). • True Positives (TP) = 90 False Positives (FP) = 10 • False Negatives (FN) = 15 True Negatives (TN) = 885 • Precision = 90/90+10 = 0.9 • Recall= 90/90+15 = 0.857 • F1 Score= 2 x (0.9 x 0.857 / 0.9+0.857) = 0.878 The F1 score for this classification model is approximately 0.878. It provides a single metric that considers both precision and recall, making it useful for evaluating the model's overall performance, especially in scenarios with imbalanced classes.
  • 4. ROC Curve and AUC The Receiver Operating Characteristic (ROC) curve and the Area Under the ROC Curve (AUC) are widely used evaluation metrics for binary classification models. They are particularly useful when dealing with imbalanced datasets or when the cost of false positives and false negatives varies.
  • 5. ROC curve • The ROC curve is a graphical representation of the trade-off between the true positive rate (sensitivity) and the false positive rate (1 - specificity) for different threshold values. • The true positive rate (TPR) is the ratio of true positive predictions to the total actual positive instances in the dataset. It represents the model's ability to correctly identify positive instances. • The false positive rate (FPR) is the ratio of false positive predictions to the total actual negative instances in the dataset. It represents the model's tendency to incorrectly identify negative instances as positive.
  • 6. ROC curve • The ROC curve plots the TPR against the FPR as the discrimination threshold is varied from 0 to 1. Each point on the curve represents a different threshold, and the curve illustrates how the model's performance changes across various threshold values. • A diagonal line from the bottom-left corner to the top-right corner represents random guessing (an ineffective model). A good model's ROC curve will be closer to the top-left corner, indicating high TPR and low FPR across different thresholds.
  • 7. AUC (Area under the ROC curve) • The AUC quantifies the overall performance of a classification model by calculating the area under the ROC curve. • A perfect classifier would have an AUC of 1, indicating that it achieves a TPR of 1 (identifies all positives correctly) while maintaining an FPR of 0 (makes no false positive predictions). • A random classifier would have an AUC of 0.5, as the ROC curve would be a diagonal line from (0,0) to (1,1). • The AUC provides a single scalar value that summarizes the model's performance across all possible classification thresholds. Higher AUC values indicate better overall performance, with values closer to 1 indicating better discrimination between positive and negative instances.
  • 8. AUC (Area under the ROC curve) • Generally, an AUC above 0.8 is considered good, while an AUC above 0.9 is considered excellent. An AUC below 0.7 might indicate poor discriminatory power.
  • 9. Confusion Matrix A confusion matrix is a table that is often used to evaluate the performance of a classification model. It provides a comprehensive summary of the model's predictions compared to the actual outcomes in a tabular format. Each row of the matrix represents the instances in a predicted class, while each column represents the instances in an actual class. Predicted Actual Positive Negative Positive (P) True Positive False Positive Negative (N) False Negative True Negative
  • 10. Components of confusion matrix True Positives (TP): These are the cases where the model correctly predicts the positive class. For example, in a medical diagnosis scenario, TP would represent the number of patients correctly diagnosed with a disease. False Positives (FP): These are the cases where the model incorrectly predicts the positive class when it's actually negative. In medical terms, FP would represent healthy patients incorrectly diagnosed with a disease. False Negatives (FN): These are the cases where the model incorrectly predicts the negative class when it's actually positive. In medical terms, FN would represent patients with a disease incorrectly classified as healthy.
  • 11. Components of confusion matrix True Negatives (TN): These are the cases where the model correctly predicts the negative class. For example, in a medical diagnosis scenario, TN would represent the number of healthy patients correctly identified as such. The confusion matrix is a valuable tool for understanding the strengths and weaknesses of a classification model, particularly in scenarios with imbalanced classes or when certain types of errors (e.g., false positives or false negatives) are more costly or critical than others. Please check the description box for the link to Machine Learning videos.
  • 12. Evaluating model for Imbalanced datasets When dealing with imbalanced datasets in classification tasks, where the number of instances in one class significantly outweighs the other, standard evaluation metrics like accuracy can be misleading. strategies for effectively evaluating models trained on imbalanced datasets  Confusion Matrix Precision, Recall and F1 Score ROC curve and AUC Ensemble methods Resampling techniques: oversampling the minority class or under sampling the majority class to balance the dataset before evaluation. Use stratified sampling when splitting the dataset into training and testing sets to ensure that the class distribution remains consistent across both sets.
  • 13. Thanks for Watching! Please check the description box for the link to Machine Learning videos.