SlideShare a Scribd company logo
Confusion Matrix
1
Confusion Matrix
 A confusion matrix for a two classes (+, -) is shown below.
 There are four quadrants in the confusion matrix, which are symbolized as
below.
 True Positive (TP: f++) : The number of instances that were positive (+) and
correctly classified as positive (+).
 False Negative (FN: f+-): The number of instances that were positive (+) and
incorrectly classified as negative (-).
 False Positive (FP: f-+): The number of instances that were negative (-) and
incorrectly classified as (+).
 True Negative (TN: f--): The number of instances that were negative (-) and
correctly classified as (-).
2
Confusion Matrix
Note:
 Np = TP (f++) + FN (f+-)
= is the total number of positive instances.
 Nn = FP(f-+) + Tn(f--)
= is the total number of negative instances.
 N = Np + Nn
= is the total number of instances.
 (TP + TN) denotes the number of correct classification
 (FP + FN) denotes the number of errors in classification.
 For a perfect classifier, FP = FN = 0
3
Confusion Matrix Example
 For example,
Calculate the performance evaluation metrics
4
Class + -
+ 52 (TP) 18 (FN)
- 21 (FP) 123 (TN)
Accuracy
 It is defined as the fraction of the number of examples that are correctly
classified by the classifier to the total number of instances.
Accuracy=
𝑇𝑃+𝑇𝑁
𝑇𝑃+𝐹𝑃+𝐹𝑁+𝑇𝑁
5
Performance Evaluation Metrics
 We now define a number of metrics for the measurement of a classifier.
 In our discussion, we shall make the assumptions that there are only two classes:
+ (positive) and – (negative)
 True Positive Rate (TPR): It is defined as the fraction of the positive
examples predicted correctly by the classifier.
𝑇𝑃𝑅 =
𝑇𝑃
𝑃
=
𝑇𝑃
𝑇𝑃+𝐹𝑁
=
𝑓++
𝑓+++𝑓+−
 This metrics is also known as Recall, Sensitivity or Hit rate.
 False Positive Rate (FPR): It is defined as the fraction of negative examples
classified as positive class by the classifier.
𝐹𝑃𝑅 =
𝐹𝑃
𝑁
=
𝐹𝑃
𝐹𝑃 + 𝑇𝑁
=
𝑓 − +
𝑓 −+
+𝑓−−
6
Performance Evaluation Metrics
 False Negative Rate (FNR): It is defined as the fraction of positive
examples classified as a negative class by the classifier.
𝐹𝑁𝑅 =
𝐹𝑁
𝑃
=
𝐹𝑁
𝑇𝑃 + 𝐹𝑁
=
𝑓+−
𝑓++ + 𝑓+−
 True Negative Rate (TNR): It is defined as the fraction of negative
examples classified correctly by the classifier
𝑇𝑁𝑅 =
𝑇𝑁
𝑁
=
𝑇𝑁
𝑇𝑁 + 𝐹𝑃
=
𝑓−−
𝑓−− + 𝑓 − +
 This metric is also known as Specificity.
7
Performance Evaluation Metrics
 Both, Precision and Recall are defined by
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 =
𝑇𝑃
𝑇𝑃 + 𝐹𝑃
𝑅𝑒𝑐𝑎𝑙𝑙 =
𝑇𝑃
𝑇𝑃 + 𝐹𝑁
8
Performance Evaluation Metrics
9
 F1 Score (F1): Recall (r) and Precision (p) are two
widely used metrics employed in analysis..
 It is defined in terms of (r or Recall) and (p or
Precision) as follows.
𝐹1𝑆𝑐𝑜𝑟𝑒 =
2 ∗ 𝑅𝑒𝑐𝑎𝑙𝑙 . 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛
𝑅𝑒𝑐𝑎𝑙𝑙 + 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛
=
2𝑇𝑃
2𝑇𝑃 + 𝐹𝑃 + 𝐹𝑁
Note
 F1 represents the harmonic mean between recall and
precision
 High value of F1 score ensures that both Precision and
Recall are reasonably high.
Analysis with Performance Measurement Metrics
 Based on the various performance metrics, we can characterize a classifier.
 We do it in terms of TPR, FPR, Precision and Recall and Accuracy
 Case 1: Perfect Classifier
When every instance is correctly classified, it is called the perfect classifier. In this
case, TP = P, TN = N and CM is
TPR = TP/(TP+FN)=
𝑃
𝑃
=1
FPR =
0
𝑁
=0
Precision =
𝑃
𝑃
= 1
F1 Score =
2×1
1+1
= 1
Accuracy =
𝑃+𝑁
𝑃+𝑁
= 1
10
Predicted Class
+ -
Actual
class + P 0
- 0 N
Analysis with Performance Measurement Metrics
 Case 2: Worst Classifier
When every instance is wrongly classified, it is called the worst classifier. In this
case, TP = 0, TN = 0 and the CM is
TPR =
0
𝑃
=0
FPR =
𝑁
𝑁
= 1
Precision =
0
𝑁
= 0
F1 Score = Not applicable
as Recall + Precision = 0
Accuracy =
0
𝑃+𝑁
= 0
11
Predicted Class
+ -
Actual
class
+ 0 P
- N 0
Analysis with Performance Measurement Metrics
 Case 3: Ultra-Liberal Classifier
The classifier always predicts the + class correctly. Here, the False Negative
(FN) and True Negative (TN) are zero. The CM is
TPR =
𝑃
𝑃
= 1
FPR =
𝑁
𝑁
= 1
Precision =
𝑃
𝑃+𝑁
F1 Score =
2𝑃
2𝑃+𝑁
Accuracy =
𝑃
𝑃+𝑁
= 0
12
Predicted Class
+ -
Actual
class
+ P 0
- N 0
Analysis with Performance Measurement Metrics
 Case 4: Ultra-Conservative Classifier
This classifier always predicts the - class correctly. Here, the False Negative
(FN) and True Negative (TN) are zero. The CM is
TPR =
0
𝑃
= 0
FPR =
0
𝑁
= 0
Precision = Not applicable
(as TP + FP = 0)
F1 Score = Not applicable
Accuracy =
𝑁
𝑃+𝑁
= 0
13
Predicted Class
+ -
Actual
class
+ 0 p
- 0 N

More Related Content

Similar to Confusion Matrix.pptx

Model Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUC
Model Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUCModel Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUC
Model Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUC
Megha Sharma
 
Machine learning session5(logistic regression)
Machine learning   session5(logistic regression)Machine learning   session5(logistic regression)
Machine learning session5(logistic regression)
Abhimanyu Dwivedi
 
Machine Learning Performance metrics for classification
Machine Learning Performance metrics for classificationMachine Learning Performance metrics for classification
Machine Learning Performance metrics for classification
Kuppusamy P
 
MLA_Confusion Matrix for Classification
MLA_Confusion Matrix for ClassificationMLA_Confusion Matrix for Classification
MLA_Confusion Matrix for Classification
Shruti Chaudhari
 
Evaluation metrics for binary classification - the ultimate guide
Evaluation metrics for binary classification - the ultimate guideEvaluation metrics for binary classification - the ultimate guide
Evaluation metrics for binary classification - the ultimate guide
neptune.ml
 
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
 
MODEL EVALUATION.pptx
MODEL  EVALUATION.pptxMODEL  EVALUATION.pptx
MODEL EVALUATION.pptx
KARPAGAMT3
 
Deep Learning for Computer Vision: Image Classification (UPC 2016)
Deep Learning for Computer Vision: Image Classification (UPC 2016)Deep Learning for Computer Vision: Image Classification (UPC 2016)
Deep Learning for Computer Vision: Image Classification (UPC 2016)
Universitat Politècnica de Catalunya
 
Common evaluation measures in NLP and IR
Common evaluation measures in NLP and IRCommon evaluation measures in NLP and IR
Common evaluation measures in NLP and IR
Rushdi Shams
 
section11_Nonparametric.ppt
section11_Nonparametric.pptsection11_Nonparametric.ppt
section11_Nonparametric.ppt
ssuser44b4b7
 
Machine learning by Dr. Vivek Vijay and Dr. Sandeep Yadav
Machine learning by Dr. Vivek Vijay and Dr. Sandeep YadavMachine learning by Dr. Vivek Vijay and Dr. Sandeep Yadav
Machine learning by Dr. Vivek Vijay and Dr. Sandeep Yadav
Agile Testing Alliance
 
ML-ChapterFour-ModelEvaluation.pptx
ML-ChapterFour-ModelEvaluation.pptxML-ChapterFour-ModelEvaluation.pptx
ML-ChapterFour-ModelEvaluation.pptx
belay41
 

Similar to Confusion Matrix.pptx (12)

Model Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUC
Model Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUCModel Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUC
Model Evaluation Matrix: Confusion Matrix, F1 Score, ROC curve AUC
 
Machine learning session5(logistic regression)
Machine learning   session5(logistic regression)Machine learning   session5(logistic regression)
Machine learning session5(logistic regression)
 
Machine Learning Performance metrics for classification
Machine Learning Performance metrics for classificationMachine Learning Performance metrics for classification
Machine Learning Performance metrics for classification
 
MLA_Confusion Matrix for Classification
MLA_Confusion Matrix for ClassificationMLA_Confusion Matrix for Classification
MLA_Confusion Matrix for Classification
 
Evaluation metrics for binary classification - the ultimate guide
Evaluation metrics for binary classification - the ultimate guideEvaluation metrics for binary classification - the ultimate guide
Evaluation metrics for binary classification - the ultimate guide
 
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
 
MODEL EVALUATION.pptx
MODEL  EVALUATION.pptxMODEL  EVALUATION.pptx
MODEL EVALUATION.pptx
 
Deep Learning for Computer Vision: Image Classification (UPC 2016)
Deep Learning for Computer Vision: Image Classification (UPC 2016)Deep Learning for Computer Vision: Image Classification (UPC 2016)
Deep Learning for Computer Vision: Image Classification (UPC 2016)
 
Common evaluation measures in NLP and IR
Common evaluation measures in NLP and IRCommon evaluation measures in NLP and IR
Common evaluation measures in NLP and IR
 
section11_Nonparametric.ppt
section11_Nonparametric.pptsection11_Nonparametric.ppt
section11_Nonparametric.ppt
 
Machine learning by Dr. Vivek Vijay and Dr. Sandeep Yadav
Machine learning by Dr. Vivek Vijay and Dr. Sandeep YadavMachine learning by Dr. Vivek Vijay and Dr. Sandeep Yadav
Machine learning by Dr. Vivek Vijay and Dr. Sandeep Yadav
 
ML-ChapterFour-ModelEvaluation.pptx
ML-ChapterFour-ModelEvaluation.pptxML-ChapterFour-ModelEvaluation.pptx
ML-ChapterFour-ModelEvaluation.pptx
 

More from Rahul Borate

PigHive presentation and hive impor.pptx
PigHive presentation and hive impor.pptxPigHive presentation and hive impor.pptx
PigHive presentation and hive impor.pptx
Rahul Borate
 
Unit 4_Introduction to Server Farms.pptx
Unit 4_Introduction to Server Farms.pptxUnit 4_Introduction to Server Farms.pptx
Unit 4_Introduction to Server Farms.pptx
Rahul Borate
 
Unit 3_Data Center Design in storage.pptx
Unit  3_Data Center Design in storage.pptxUnit  3_Data Center Design in storage.pptx
Unit 3_Data Center Design in storage.pptx
Rahul Borate
 
Fundamentals of storage Unit III Backup and Recovery.ppt
Fundamentals of storage Unit III Backup and Recovery.pptFundamentals of storage Unit III Backup and Recovery.ppt
Fundamentals of storage Unit III Backup and Recovery.ppt
Rahul Borate
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
Rahul Borate
 
Unit 4 SVM and AVR.ppt
Unit 4 SVM and AVR.pptUnit 4 SVM and AVR.ppt
Unit 4 SVM and AVR.ppt
Rahul Borate
 
Unit I Fundamentals of Cloud Computing.pptx
Unit I Fundamentals of Cloud Computing.pptxUnit I Fundamentals of Cloud Computing.pptx
Unit I Fundamentals of Cloud Computing.pptx
Rahul Borate
 
Unit II Cloud Delivery Models.pptx
Unit II Cloud Delivery Models.pptxUnit II Cloud Delivery Models.pptx
Unit II Cloud Delivery Models.pptx
Rahul Borate
 
QQ Plot.pptx
QQ Plot.pptxQQ Plot.pptx
QQ Plot.pptx
Rahul Borate
 
EDA.pptx
EDA.pptxEDA.pptx
EDA.pptx
Rahul Borate
 
Module III MachineLearningSparkML.pptx
Module III MachineLearningSparkML.pptxModule III MachineLearningSparkML.pptx
Module III MachineLearningSparkML.pptx
Rahul Borate
 
Unit II Real Time Data Processing tools.pptx
Unit II Real Time Data Processing tools.pptxUnit II Real Time Data Processing tools.pptx
Unit II Real Time Data Processing tools.pptx
Rahul Borate
 
2.2 Logit and Probit.pptx
2.2 Logit and Probit.pptx2.2 Logit and Probit.pptx
2.2 Logit and Probit.pptx
Rahul Borate
 
UNIT I Streaming Data & Architectures.pptx
UNIT I Streaming Data & Architectures.pptxUNIT I Streaming Data & Architectures.pptx
UNIT I Streaming Data & Architectures.pptx
Rahul Borate
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
Rahul Borate
 
Practice_Exercises_Files_and_Exceptions.pptx
Practice_Exercises_Files_and_Exceptions.pptxPractice_Exercises_Files_and_Exceptions.pptx
Practice_Exercises_Files_and_Exceptions.pptx
Rahul Borate
 
Practice_Exercises_Data_Structures.pptx
Practice_Exercises_Data_Structures.pptxPractice_Exercises_Data_Structures.pptx
Practice_Exercises_Data_Structures.pptx
Rahul Borate
 
Practice_Exercises_Control_Flow.pptx
Practice_Exercises_Control_Flow.pptxPractice_Exercises_Control_Flow.pptx
Practice_Exercises_Control_Flow.pptx
Rahul Borate
 
blog creation.pdf
blog creation.pdfblog creation.pdf
blog creation.pdf
Rahul Borate
 
Chapter I.pptx
Chapter I.pptxChapter I.pptx
Chapter I.pptx
Rahul Borate
 

More from Rahul Borate (20)

PigHive presentation and hive impor.pptx
PigHive presentation and hive impor.pptxPigHive presentation and hive impor.pptx
PigHive presentation and hive impor.pptx
 
Unit 4_Introduction to Server Farms.pptx
Unit 4_Introduction to Server Farms.pptxUnit 4_Introduction to Server Farms.pptx
Unit 4_Introduction to Server Farms.pptx
 
Unit 3_Data Center Design in storage.pptx
Unit  3_Data Center Design in storage.pptxUnit  3_Data Center Design in storage.pptx
Unit 3_Data Center Design in storage.pptx
 
Fundamentals of storage Unit III Backup and Recovery.ppt
Fundamentals of storage Unit III Backup and Recovery.pptFundamentals of storage Unit III Backup and Recovery.ppt
Fundamentals of storage Unit III Backup and Recovery.ppt
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
 
Unit 4 SVM and AVR.ppt
Unit 4 SVM and AVR.pptUnit 4 SVM and AVR.ppt
Unit 4 SVM and AVR.ppt
 
Unit I Fundamentals of Cloud Computing.pptx
Unit I Fundamentals of Cloud Computing.pptxUnit I Fundamentals of Cloud Computing.pptx
Unit I Fundamentals of Cloud Computing.pptx
 
Unit II Cloud Delivery Models.pptx
Unit II Cloud Delivery Models.pptxUnit II Cloud Delivery Models.pptx
Unit II Cloud Delivery Models.pptx
 
QQ Plot.pptx
QQ Plot.pptxQQ Plot.pptx
QQ Plot.pptx
 
EDA.pptx
EDA.pptxEDA.pptx
EDA.pptx
 
Module III MachineLearningSparkML.pptx
Module III MachineLearningSparkML.pptxModule III MachineLearningSparkML.pptx
Module III MachineLearningSparkML.pptx
 
Unit II Real Time Data Processing tools.pptx
Unit II Real Time Data Processing tools.pptxUnit II Real Time Data Processing tools.pptx
Unit II Real Time Data Processing tools.pptx
 
2.2 Logit and Probit.pptx
2.2 Logit and Probit.pptx2.2 Logit and Probit.pptx
2.2 Logit and Probit.pptx
 
UNIT I Streaming Data & Architectures.pptx
UNIT I Streaming Data & Architectures.pptxUNIT I Streaming Data & Architectures.pptx
UNIT I Streaming Data & Architectures.pptx
 
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptxUNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
 
Practice_Exercises_Files_and_Exceptions.pptx
Practice_Exercises_Files_and_Exceptions.pptxPractice_Exercises_Files_and_Exceptions.pptx
Practice_Exercises_Files_and_Exceptions.pptx
 
Practice_Exercises_Data_Structures.pptx
Practice_Exercises_Data_Structures.pptxPractice_Exercises_Data_Structures.pptx
Practice_Exercises_Data_Structures.pptx
 
Practice_Exercises_Control_Flow.pptx
Practice_Exercises_Control_Flow.pptxPractice_Exercises_Control_Flow.pptx
Practice_Exercises_Control_Flow.pptx
 
blog creation.pdf
blog creation.pdfblog creation.pdf
blog creation.pdf
 
Chapter I.pptx
Chapter I.pptxChapter I.pptx
Chapter I.pptx
 

Recently uploaded

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 

Recently uploaded (20)

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 

Confusion Matrix.pptx

  • 2. Confusion Matrix  A confusion matrix for a two classes (+, -) is shown below.  There are four quadrants in the confusion matrix, which are symbolized as below.  True Positive (TP: f++) : The number of instances that were positive (+) and correctly classified as positive (+).  False Negative (FN: f+-): The number of instances that were positive (+) and incorrectly classified as negative (-).  False Positive (FP: f-+): The number of instances that were negative (-) and incorrectly classified as (+).  True Negative (TN: f--): The number of instances that were negative (-) and correctly classified as (-). 2
  • 3. Confusion Matrix Note:  Np = TP (f++) + FN (f+-) = is the total number of positive instances.  Nn = FP(f-+) + Tn(f--) = is the total number of negative instances.  N = Np + Nn = is the total number of instances.  (TP + TN) denotes the number of correct classification  (FP + FN) denotes the number of errors in classification.  For a perfect classifier, FP = FN = 0 3
  • 4. Confusion Matrix Example  For example, Calculate the performance evaluation metrics 4 Class + - + 52 (TP) 18 (FN) - 21 (FP) 123 (TN)
  • 5. Accuracy  It is defined as the fraction of the number of examples that are correctly classified by the classifier to the total number of instances. Accuracy= 𝑇𝑃+𝑇𝑁 𝑇𝑃+𝐹𝑃+𝐹𝑁+𝑇𝑁 5
  • 6. Performance Evaluation Metrics  We now define a number of metrics for the measurement of a classifier.  In our discussion, we shall make the assumptions that there are only two classes: + (positive) and – (negative)  True Positive Rate (TPR): It is defined as the fraction of the positive examples predicted correctly by the classifier. 𝑇𝑃𝑅 = 𝑇𝑃 𝑃 = 𝑇𝑃 𝑇𝑃+𝐹𝑁 = 𝑓++ 𝑓+++𝑓+−  This metrics is also known as Recall, Sensitivity or Hit rate.  False Positive Rate (FPR): It is defined as the fraction of negative examples classified as positive class by the classifier. 𝐹𝑃𝑅 = 𝐹𝑃 𝑁 = 𝐹𝑃 𝐹𝑃 + 𝑇𝑁 = 𝑓 − + 𝑓 −+ +𝑓−− 6
  • 7. Performance Evaluation Metrics  False Negative Rate (FNR): It is defined as the fraction of positive examples classified as a negative class by the classifier. 𝐹𝑁𝑅 = 𝐹𝑁 𝑃 = 𝐹𝑁 𝑇𝑃 + 𝐹𝑁 = 𝑓+− 𝑓++ + 𝑓+−  True Negative Rate (TNR): It is defined as the fraction of negative examples classified correctly by the classifier 𝑇𝑁𝑅 = 𝑇𝑁 𝑁 = 𝑇𝑁 𝑇𝑁 + 𝐹𝑃 = 𝑓−− 𝑓−− + 𝑓 − +  This metric is also known as Specificity. 7
  • 8. Performance Evaluation Metrics  Both, Precision and Recall are defined by 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 = 𝑇𝑃 𝑇𝑃 + 𝐹𝑃 𝑅𝑒𝑐𝑎𝑙𝑙 = 𝑇𝑃 𝑇𝑃 + 𝐹𝑁 8
  • 9. Performance Evaluation Metrics 9  F1 Score (F1): Recall (r) and Precision (p) are two widely used metrics employed in analysis..  It is defined in terms of (r or Recall) and (p or Precision) as follows. 𝐹1𝑆𝑐𝑜𝑟𝑒 = 2 ∗ 𝑅𝑒𝑐𝑎𝑙𝑙 . 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 𝑅𝑒𝑐𝑎𝑙𝑙 + 𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 = 2𝑇𝑃 2𝑇𝑃 + 𝐹𝑃 + 𝐹𝑁 Note  F1 represents the harmonic mean between recall and precision  High value of F1 score ensures that both Precision and Recall are reasonably high.
  • 10. Analysis with Performance Measurement Metrics  Based on the various performance metrics, we can characterize a classifier.  We do it in terms of TPR, FPR, Precision and Recall and Accuracy  Case 1: Perfect Classifier When every instance is correctly classified, it is called the perfect classifier. In this case, TP = P, TN = N and CM is TPR = TP/(TP+FN)= 𝑃 𝑃 =1 FPR = 0 𝑁 =0 Precision = 𝑃 𝑃 = 1 F1 Score = 2×1 1+1 = 1 Accuracy = 𝑃+𝑁 𝑃+𝑁 = 1 10 Predicted Class + - Actual class + P 0 - 0 N
  • 11. Analysis with Performance Measurement Metrics  Case 2: Worst Classifier When every instance is wrongly classified, it is called the worst classifier. In this case, TP = 0, TN = 0 and the CM is TPR = 0 𝑃 =0 FPR = 𝑁 𝑁 = 1 Precision = 0 𝑁 = 0 F1 Score = Not applicable as Recall + Precision = 0 Accuracy = 0 𝑃+𝑁 = 0 11 Predicted Class + - Actual class + 0 P - N 0
  • 12. Analysis with Performance Measurement Metrics  Case 3: Ultra-Liberal Classifier The classifier always predicts the + class correctly. Here, the False Negative (FN) and True Negative (TN) are zero. The CM is TPR = 𝑃 𝑃 = 1 FPR = 𝑁 𝑁 = 1 Precision = 𝑃 𝑃+𝑁 F1 Score = 2𝑃 2𝑃+𝑁 Accuracy = 𝑃 𝑃+𝑁 = 0 12 Predicted Class + - Actual class + P 0 - N 0
  • 13. Analysis with Performance Measurement Metrics  Case 4: Ultra-Conservative Classifier This classifier always predicts the - class correctly. Here, the False Negative (FN) and True Negative (TN) are zero. The CM is TPR = 0 𝑃 = 0 FPR = 0 𝑁 = 0 Precision = Not applicable (as TP + FP = 0) F1 Score = Not applicable Accuracy = 𝑁 𝑃+𝑁 = 0 13 Predicted Class + - Actual class + 0 p - 0 N