SlideShare a Scribd company logo
1 of 47
Performance Metrics
Learning Objectives
✦Discuss the need for performance metrics
✦List and analyse the key methods of performance metrics
Need for Performance Metrics
Non Technical Domain
Need for Performance Metrics
Technical Domain
Need for Performance Metrics
✦How do you rank machine learning algorithm?
✦How can you pick one algorithm over the other?
✦How do you measure and compare these
algorithms?
Need for Performance Metrics
✦ Performance metric is the answer to these
questions.
✦It helps measure and compare algorithms.
- Stephen Few
“Numbers have an important story to tell.
They rely on you to give them a voice.”
Performance Metrics
- Stephen Few
“Numbers have an important story to tell.
They rely on you to give them a voice.”
Performance Metrics
Assess Machine Learning Algorithms
Machine learning models are evaluated against your selected performance
metrics
Help evaluate efficiency and accuracy of machine learning models
Key Methods of Performance
Metrics
Confusion Matrix Accuracy
Precision Recall
Specificity F1 Score
Meaning of Confusion Matrix
TP FP
FN TN
Actual
Positives(1) Negatives(0)
Positives(1)
Negatives(0)
Predicted
One of the most intuitive and easiest metrics used to find
correctness and accuracy
Not a performance measure
Almost all performance metrics are based on confusion matrix
Confusion Matrix : Example
Cancer Prediction System
There are different approaches that can
hep the center predict cancer
Okay
Let me introduce you to one of the easiest
matrices that can help you predict whether a
person has cancer, the confusion matrix.
Confusion Matrix : Classification
Problem
How to predict if a person has cancer?
Give a label / class to the target variables:
When a person is diagnosed with cancer
When a person is does not have cancer
1
0
Confusion Matrix : Classification
Problem
TP FP
FN TN
Actual
Positives(1) Negatives(0)
Positives(1)
Negatives(0)
Predicted
Sets of classes are given in both dimensions
Terms of Confusion Matrix
True PositiveTP
True Negative TN
False Negative FN
False PositiveFP
TP FP
FN TN
Actual
Positives(1) Negatives(0)
Positives(1)
Negatives(0)
Predicted
True Positive
True Positive
T
P
T
N
F
N
F
P
True Positives are the cases where the actual
class of the data point is 1 (true) and the
predicted value is also 1 (true).
The case where a person has cancer and the
model classifies the case as cancer positive
comes under true positive.
True Negative
True Negative
T
P
T
N
F
N
F
P
True Negatives are the cases when the actual
class of the data point is 0 (false) and the
predicted is also 0 (false). It is negative
because the class predicted was negative.
The case where a person does not have
cancer and the model classifies the case as
cancer negative comes under true negative.
False Positive
T
P
T
N
F
N
F
P
False positives are the cases when the actual
class of the data point is 0 (false) and the
predicted is 1 (true). It is false because the
model has predicted incorrectly.
The case where a person does not have
cancer and the model classifies the case as
cancer positive comes under false positive.
False Positive
False Negative
False Negative
T
P
T
N
F
N
F
P
• False negatives are the cases when the
actual class of the data point is 1 (true) and
the predicted is 0 (false).
• It is false because the model has predicted
incorrectly.
• It is negative because the class predicted
was negative.
The case where a person has cancer and the
model classifies the case as cancer negative
comes under false negatives.
Minimize False Cases
What should be
minimised?
✦A model is best identified by its accuracy
✦No rules are defined to identify false cases
✦It depends on business requirements and context
of the problem.
Minimize False Negative :
Example
Out of 100
people
Actual cancer
patients = 5
Bad Model
Predicts everyone as non-
cancerous
Accuracy = 95%
When a person who does not have cancer is
classified as cancerous
Missing a cancer patient will be a huge
mistake
Minimize False Positive :
Example
The model needs to classify an email as spam or ham (term used for
genuine email).
Assign a label / class to the target variables:
Email is spam
Email is not spam
1
0
Minimize False Positive :
Example
Incoming mail Model
In case of false positive
Important email as spam
! Business stands a chance to miss
an important communication
An important email marked as
spam is more business critical
than diverting a spam email to
inbox.
Classifies
Accuracy
In classification problems, accuracy is defined
by the total number of correct predictions
made out of all the predictions.
Accuracy : Calculation
TP FP
FN TN
Actual
Positives(1) Negatives(0)
Positives(1)
Negatives(0)
Predicates
Accuracy =
TP + TN
TP + FP + FN + TN
Accuracy : Example
When the target variable
classes in the data are nearly
balanced
When do we use
accuracy?
Accuracy : Example
The machine learning model will
have approximately 97%
accuracy in any new predictions.
Accuracy : Example
5 out of 100 people have cancer
When do you
NOT use
accuracy?
It’s a bad model and predicts every case as
noncancerous
It classifies 95 noncancerous patients correctly and 5
cancerous patients as noncancerous
Accuracy of the model is 95%
When the target variable classes in the data are a
majority of one class
Precision
• Refers to the closeness of two or more
measurements
• Aims at deriving correct proportion of
positive identifications
Precision : Calculation
TP FP
FN TN
Actual
Positives(1) Negatives(0)
Positives(1)
Negatives(0)
Predicates
Precision =
TP
TP + FP
Precision : Example
Its a bad model and predicts every case as cancer
When do we use
precision?
Everyone has been predicted as having cancer
Precision of the model is 5%
5 out of 100 people have cancer
Recall or Sensitivity
Recall or sensitivity measures the proportion of
actual positives and that are correctly identified.
Recall or Sensitivity : Calculation
TP FP
FN TN
Actual
Positives(1) Negatives(0)
Positives(1)
Negatives(0)
Predicates
Recall =
TP
TP + FN
Recall or Sensitivity : Example
Predicts every case as cancer
When do we use
recall?
Recall is 100%
Precision of the model is 5%
5 out of 100 people have cancer
Recall as a Measure
When do we use
precision and
when do we use
recall?
Precision is about being
precise, whereas recall is about
capturing all the cases.
Recall as a Measure
When do we use
precision and
when do we use
recall?
If the model captures one
correct cancer positive case, it is
100% precise.
Recall as a Measure
When do we use
precision and
when do we use
recall?
If the model captures ever case
as cancer positive, you
have100% recall.
Recall as a Measure
When do we use
precision and
when do we use
recall?
To focus on minimising false
negatives you would want 100%
recall with a good precision
score.
Recall as a Measure
When do we use
precision and
when do we use
recall?
To focus on minimising false
positives you should aim for
100% precision.
Specificity
• Measures = proportion of actual negatives
that are correctly identified
• Tries to identify probability of a negative test
result when input with a negative example
Specificity : Calculation
TP FP
FN TN
Actual
Positives(1) Negatives(0)
Positives(1)
Negatives(0)
Predicates
Specificity =
TN
TN + FP
Specificity : Example
Predicts every case as cancer
So specificity is
the exact
opposite of
recall
Specificity is 0%
5 out of 100 people have cancer
F1 Score
Do you have to carry both precision and
recall in your pockets every time you
make a model to solve a classification
problem?
No to avoid taking both precision and
recall, its best to get a single score
(F1 score) that can represent both
precision (P) and recall (R).
F1 Score : Calculation
3 97
0 0
Actual
Fraud Not Fraud
Fraud
Not Fraud
Predicates
F1 Score =
2 * Precision * Recall
Precision + Recall
F1 Score : Example
97 out of 100 credit card transactions are legit and 3 are
fraud
When do you
use F1 score?
Predicts everything as fraud
Fraud detection
F1 Score : Example
Precision =
3
100
= 3%
Recall =
100
3
= 100%
Arithmetic Mean =
3+100
2
= 51.5%
Harmonic Mean
• Harmonic mean is an average used when x
and y are equal
• Value of the mean is smaller when x and y are
different
With reference to the fraud detection example,
F1 Score can be calculated as
F1 Score =
2 * Precision * Recall
Precision + Recall
=
2 * 3 * 100
100 + 3
= 5%
Key Takeaways
✦Confusion matrix is used to find correctness and accusation of machine learning models. It is
also used for classification problems where the output can be one of two or more types of
classes.
✦Accuracy is the number of correct prediction made by the model over all kinds of predictions.
✦Precisision refers to the closeness of two or more measurements to each other
✦Recall measures the proportion of actual positives that are identified correctly.
✦Specificity measures the proportion of actual negatives that are identified correctly.
✦F1 Score gives a single score that represents both precision (P) and recall (R).
✦Harmonic mean is used when the sample data contains extreme value because it is more
balanced than arithmetic mean.

More Related Content

What's hot

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 YadavAgile Testing Alliance
 
ADDITTIVE WHITE GAUSIAN NOIS ( AWGN)
ADDITTIVE WHITE GAUSIAN NOIS ( AWGN)ADDITTIVE WHITE GAUSIAN NOIS ( AWGN)
ADDITTIVE WHITE GAUSIAN NOIS ( AWGN)mohammedalimahdi
 
Timing synchronization F Ling_v1
Timing synchronization F Ling_v1Timing synchronization F Ling_v1
Timing synchronization F Ling_v1Fuyun Ling
 
Confusion matrix and classification evaluation metrics
Confusion matrix and classification evaluation metricsConfusion matrix and classification evaluation metrics
Confusion matrix and classification evaluation metricsMinesh A. Jethva
 
Data Mining: Concepts and Techniques — Chapter 2 —
Data Mining:  Concepts and Techniques — Chapter 2 —Data Mining:  Concepts and Techniques — Chapter 2 —
Data Mining: Concepts and Techniques — Chapter 2 —Salah Amean
 
Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...
Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...
Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...Md. Main Uddin Rony
 
Depth Fusion from RGB and Depth Sensors by Deep Learning
Depth Fusion from RGB and Depth Sensors by Deep LearningDepth Fusion from RGB and Depth Sensors by Deep Learning
Depth Fusion from RGB and Depth Sensors by Deep LearningYu Huang
 
Pulse code modulation and Demodulation
Pulse code modulation and DemodulationPulse code modulation and Demodulation
Pulse code modulation and DemodulationAbdul Razaq
 
Dimension Reduction: What? Why? and How?
Dimension Reduction: What? Why? and How?Dimension Reduction: What? Why? and How?
Dimension Reduction: What? Why? and How?Kazi Toufiq Wadud
 
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hakky St
 
Classification Based Machine Learning Algorithms
Classification Based Machine Learning AlgorithmsClassification Based Machine Learning Algorithms
Classification Based Machine Learning AlgorithmsMd. Main Uddin Rony
 
Model evaluation - machine learning
Model evaluation - machine learningModel evaluation - machine learning
Model evaluation - machine learningSon Phan
 
PCA and LDA in machine learning
PCA and LDA in machine learningPCA and LDA in machine learning
PCA and LDA in machine learningAkhilesh Joshi
 
Stochastic Gradient Decent (SGD).pptx
Stochastic Gradient Decent (SGD).pptxStochastic Gradient Decent (SGD).pptx
Stochastic Gradient Decent (SGD).pptxShubham Jaybhaye
 
Parallel sorting Algorithms
Parallel  sorting AlgorithmsParallel  sorting Algorithms
Parallel sorting AlgorithmsGARIMA SHAKYA
 

What's hot (20)

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
 
Convolution&Correlation
Convolution&CorrelationConvolution&Correlation
Convolution&Correlation
 
ADDITTIVE WHITE GAUSIAN NOIS ( AWGN)
ADDITTIVE WHITE GAUSIAN NOIS ( AWGN)ADDITTIVE WHITE GAUSIAN NOIS ( AWGN)
ADDITTIVE WHITE GAUSIAN NOIS ( AWGN)
 
Timing synchronization F Ling_v1
Timing synchronization F Ling_v1Timing synchronization F Ling_v1
Timing synchronization F Ling_v1
 
K Nearest Neighbor Algorithm
K Nearest Neighbor AlgorithmK Nearest Neighbor Algorithm
K Nearest Neighbor Algorithm
 
Confusion matrix and classification evaluation metrics
Confusion matrix and classification evaluation metricsConfusion matrix and classification evaluation metrics
Confusion matrix and classification evaluation metrics
 
Data Mining: Concepts and Techniques — Chapter 2 —
Data Mining:  Concepts and Techniques — Chapter 2 —Data Mining:  Concepts and Techniques — Chapter 2 —
Data Mining: Concepts and Techniques — Chapter 2 —
 
Lecture5 - C4.5
Lecture5 - C4.5Lecture5 - C4.5
Lecture5 - C4.5
 
Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...
Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...
Data Analysis: Evaluation Metrics for Supervised Learning Models of Machine L...
 
Depth Fusion from RGB and Depth Sensors by Deep Learning
Depth Fusion from RGB and Depth Sensors by Deep LearningDepth Fusion from RGB and Depth Sensors by Deep Learning
Depth Fusion from RGB and Depth Sensors by Deep Learning
 
Pulse code modulation and Demodulation
Pulse code modulation and DemodulationPulse code modulation and Demodulation
Pulse code modulation and Demodulation
 
Dimension Reduction: What? Why? and How?
Dimension Reduction: What? Why? and How?Dimension Reduction: What? Why? and How?
Dimension Reduction: What? Why? and How?
 
Kmeans
KmeansKmeans
Kmeans
 
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
 
Classification Based Machine Learning Algorithms
Classification Based Machine Learning AlgorithmsClassification Based Machine Learning Algorithms
Classification Based Machine Learning Algorithms
 
Model evaluation - machine learning
Model evaluation - machine learningModel evaluation - machine learning
Model evaluation - machine learning
 
PCA and LDA in machine learning
PCA and LDA in machine learningPCA and LDA in machine learning
PCA and LDA in machine learning
 
Stochastic Gradient Decent (SGD).pptx
Stochastic Gradient Decent (SGD).pptxStochastic Gradient Decent (SGD).pptx
Stochastic Gradient Decent (SGD).pptx
 
Naive Bayes
Naive BayesNaive Bayes
Naive Bayes
 
Parallel sorting Algorithms
Parallel  sorting AlgorithmsParallel  sorting Algorithms
Parallel sorting Algorithms
 

Similar to 04 performance metrics v2

Performance Metrics, Baseline Model, and Hyper Parameter
Performance Metrics, Baseline Model, and Hyper ParameterPerformance Metrics, Baseline Model, and Hyper Parameter
Performance Metrics, Baseline Model, and Hyper ParameterIndraFransiskusAlam1
 
Machine learning session5(logistic regression)
Machine learning   session5(logistic regression)Machine learning   session5(logistic regression)
Machine learning session5(logistic regression)Abhimanyu Dwivedi
 
MACHINE LEARNING PPT K MEANS CLUSTERING.
MACHINE LEARNING PPT K MEANS CLUSTERING.MACHINE LEARNING PPT K MEANS CLUSTERING.
MACHINE LEARNING PPT K MEANS CLUSTERING.AmnaArooj13
 
Important Classification and Regression Metrics.pptx
Important Classification and Regression Metrics.pptxImportant Classification and Regression Metrics.pptx
Important Classification and Regression Metrics.pptxChode Amarnath
 
Sensitivity and Specificity in Predictive Modeling
Sensitivity and Specificity in Predictive ModelingSensitivity and Specificity in Predictive Modeling
Sensitivity and Specificity in Predictive ModelingSarajit Poddar, GPHR, HRMP
 
ML-ChapterFour-ModelEvaluation.pptx
ML-ChapterFour-ModelEvaluation.pptxML-ChapterFour-ModelEvaluation.pptx
ML-ChapterFour-ModelEvaluation.pptxbelay41
 
What So Funny About Proportion Testv3
What So Funny About Proportion Testv3What So Funny About Proportion Testv3
What So Funny About Proportion Testv3ChrisConnors
 
DL.f23-lec15.ConfusionMatrix.pptx
DL.f23-lec15.ConfusionMatrix.pptxDL.f23-lec15.ConfusionMatrix.pptx
DL.f23-lec15.ConfusionMatrix.pptxAyeshaIfkikhar
 
Machine Learning Unit 2 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 2 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 2 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 2 Semester 3 MSc IT Part 2 Mumbai UniversityMadhav Mishra
 
Model selection and cross validation techniques
Model selection and cross validation techniquesModel selection and cross validation techniques
Model selection and cross validation techniquesVenkata Reddy Konasani
 
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 performanceMala Deep Upadhaya
 
Quantitative critical appraisal october 2015
Quantitative critical appraisal october 2015Quantitative critical appraisal october 2015
Quantitative critical appraisal october 2015Isla Kuhn
 
Assessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's GuideAssessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's GuideMegan Verbakel
 
VSSML18. Evaluations
VSSML18. EvaluationsVSSML18. Evaluations
VSSML18. EvaluationsBigML, Inc
 
Confusion Matrix.pptx
Confusion Matrix.pptxConfusion Matrix.pptx
Confusion Matrix.pptxRahul Borate
 
Confidence Interval ModuleOne of the key concepts of statist.docx
Confidence Interval ModuleOne of the key concepts of statist.docxConfidence Interval ModuleOne of the key concepts of statist.docx
Confidence Interval ModuleOne of the key concepts of statist.docxmaxinesmith73660
 
Performance of the classification algorithm
Performance of the classification algorithmPerformance of the classification algorithm
Performance of the classification algorithmHoopeer Hoopeer
 

Similar to 04 performance metrics v2 (20)

Performance Metrics, Baseline Model, and Hyper Parameter
Performance Metrics, Baseline Model, and Hyper ParameterPerformance Metrics, Baseline Model, and Hyper Parameter
Performance Metrics, Baseline Model, and Hyper Parameter
 
Machine learning session5(logistic regression)
Machine learning   session5(logistic regression)Machine learning   session5(logistic regression)
Machine learning session5(logistic regression)
 
MACHINE LEARNING PPT K MEANS CLUSTERING.
MACHINE LEARNING PPT K MEANS CLUSTERING.MACHINE LEARNING PPT K MEANS CLUSTERING.
MACHINE LEARNING PPT K MEANS CLUSTERING.
 
Important Classification and Regression Metrics.pptx
Important Classification and Regression Metrics.pptxImportant Classification and Regression Metrics.pptx
Important Classification and Regression Metrics.pptx
 
Sensitivity and Specificity in Predictive Modeling
Sensitivity and Specificity in Predictive ModelingSensitivity and Specificity in Predictive Modeling
Sensitivity and Specificity in Predictive Modeling
 
ML-ChapterFour-ModelEvaluation.pptx
ML-ChapterFour-ModelEvaluation.pptxML-ChapterFour-ModelEvaluation.pptx
ML-ChapterFour-ModelEvaluation.pptx
 
What So Funny About Proportion Testv3
What So Funny About Proportion Testv3What So Funny About Proportion Testv3
What So Funny About Proportion Testv3
 
DL.f23-lec15.ConfusionMatrix.pptx
DL.f23-lec15.ConfusionMatrix.pptxDL.f23-lec15.ConfusionMatrix.pptx
DL.f23-lec15.ConfusionMatrix.pptx
 
Machine Learning Unit 2 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 2 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 2 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 2 Semester 3 MSc IT Part 2 Mumbai University
 
EVALUATION IN AI.pptx
EVALUATION IN AI.pptxEVALUATION IN AI.pptx
EVALUATION IN AI.pptx
 
Model selection and cross validation techniques
Model selection and cross validation techniquesModel selection and cross validation techniques
Model selection and cross validation techniques
 
Statistics
StatisticsStatistics
Statistics
 
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
 
Quantitative critical appraisal october 2015
Quantitative critical appraisal october 2015Quantitative critical appraisal october 2015
Quantitative critical appraisal october 2015
 
Assessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's GuideAssessing Model Performance - Beginner's Guide
Assessing Model Performance - Beginner's Guide
 
VSSML18. Evaluations
VSSML18. EvaluationsVSSML18. Evaluations
VSSML18. Evaluations
 
Confusion Matrix.pptx
Confusion Matrix.pptxConfusion Matrix.pptx
Confusion Matrix.pptx
 
Confidence Interval ModuleOne of the key concepts of statist.docx
Confidence Interval ModuleOne of the key concepts of statist.docxConfidence Interval ModuleOne of the key concepts of statist.docx
Confidence Interval ModuleOne of the key concepts of statist.docx
 
Performance of the classification algorithm
Performance of the classification algorithmPerformance of the classification algorithm
Performance of the classification algorithm
 
Estimating a Population Proportion
Estimating a Population ProportionEstimating a Population Proportion
Estimating a Population Proportion
 

More from Anne Starr

I01letor20so201leutor2020
I01letor20so201leutor2020I01letor20so201leutor2020
I01letor20so201leutor2020Anne Starr
 
Iso27001leadauditor2020
Iso27001leadauditor2020Iso27001leadauditor2020
Iso27001leadauditor2020Anne Starr
 
Dncybersecurity
DncybersecurityDncybersecurity
DncybersecurityAnne Starr
 
Dancyrityshy 1foundatioieh
Dancyrityshy 1foundatioiehDancyrityshy 1foundatioieh
Dancyrityshy 1foundatioiehAnne Starr
 
2 slides(2ndvariadaystion)
2 slides(2ndvariadaystion)2 slides(2ndvariadaystion)
2 slides(2ndvariadaystion)Anne Starr
 
Awtitioneressentialsdeckscloudprac401-577
Awtitioneressentialsdeckscloudprac401-577Awtitioneressentialsdeckscloudprac401-577
Awtitioneressentialsdeckscloudprac401-577Anne Starr
 
01wslouAsentialsdeck2dpractitioneres-400
01wslouAsentialsdeck2dpractitioneres-40001wslouAsentialsdeck2dpractitioneres-400
01wslouAsentialsdeck2dpractitioneres-400Anne Starr
 
uderessAwscloentialsdeck1-2ion00
uderessAwscloentialsdeck1-2ion00uderessAwscloentialsdeck1-2ion00
uderessAwscloentialsdeck1-2ion00Anne Starr
 
Cloudhnologysstecociat
CloudhnologysstecociatCloudhnologysstecociat
CloudhnologysstecociatAnne Starr
 
Cmbysantocsddsh
CmbysantocsddshCmbysantocsddsh
CmbysantocsddshAnne Starr
 
Cddmbysantcsosh
CddmbysantcsoshCddmbysantcsosh
CddmbysantcsoshAnne Starr
 
Ccbysantsddosh
Ccbysantsddosh  Ccbysantsddosh
Ccbysantsddosh Anne Starr
 

More from Anne Starr (20)

I01letor20so201leutor2020
I01letor20so201leutor2020I01letor20so201leutor2020
I01letor20so201leutor2020
 
Iso27001leadauditor2020
Iso27001leadauditor2020Iso27001leadauditor2020
Iso27001leadauditor2020
 
Ccsddm5days
Ccsddm5daysCcsddm5days
Ccsddm5days
 
Dayblic
DayblicDayblic
Dayblic
 
Day1cspbeblic
Day1cspbeblicDay1cspbeblic
Day1cspbeblic
 
Dncybersecurity
DncybersecurityDncybersecurity
Dncybersecurity
 
Dancyrityshy 1foundatioieh
Dancyrityshy 1foundatioiehDancyrityshy 1foundatioieh
Dancyrityshy 1foundatioieh
 
2 slides(2ndvariadaystion)
2 slides(2ndvariadaystion)2 slides(2ndvariadaystion)
2 slides(2ndvariadaystion)
 
Sec4
Sec4Sec4
Sec4
 
Secuntialesse
SecuntialesseSecuntialesse
Secuntialesse
 
Securityic2
Securityic2Securityic2
Securityic2
 
)k
)k)k
)k
 
inte
inteinte
inte
 
Awtitioneressentialsdeckscloudprac401-577
Awtitioneressentialsdeckscloudprac401-577Awtitioneressentialsdeckscloudprac401-577
Awtitioneressentialsdeckscloudprac401-577
 
01wslouAsentialsdeck2dpractitioneres-400
01wslouAsentialsdeck2dpractitioneres-40001wslouAsentialsdeck2dpractitioneres-400
01wslouAsentialsdeck2dpractitioneres-400
 
uderessAwscloentialsdeck1-2ion00
uderessAwscloentialsdeck1-2ion00uderessAwscloentialsdeck1-2ion00
uderessAwscloentialsdeck1-2ion00
 
Cloudhnologysstecociat
CloudhnologysstecociatCloudhnologysstecociat
Cloudhnologysstecociat
 
Cmbysantocsddsh
CmbysantocsddshCmbysantocsddsh
Cmbysantocsddsh
 
Cddmbysantcsosh
CddmbysantcsoshCddmbysantcsosh
Cddmbysantcsosh
 
Ccbysantsddosh
Ccbysantsddosh  Ccbysantsddosh
Ccbysantsddosh
 

Recently uploaded

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Recently uploaded (20)

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

04 performance metrics v2

  • 2. Learning Objectives ✦Discuss the need for performance metrics ✦List and analyse the key methods of performance metrics
  • 3. Need for Performance Metrics Non Technical Domain
  • 4. Need for Performance Metrics Technical Domain
  • 5. Need for Performance Metrics ✦How do you rank machine learning algorithm? ✦How can you pick one algorithm over the other? ✦How do you measure and compare these algorithms?
  • 6. Need for Performance Metrics ✦ Performance metric is the answer to these questions. ✦It helps measure and compare algorithms.
  • 7. - Stephen Few “Numbers have an important story to tell. They rely on you to give them a voice.” Performance Metrics
  • 8. - Stephen Few “Numbers have an important story to tell. They rely on you to give them a voice.” Performance Metrics Assess Machine Learning Algorithms Machine learning models are evaluated against your selected performance metrics Help evaluate efficiency and accuracy of machine learning models
  • 9. Key Methods of Performance Metrics Confusion Matrix Accuracy Precision Recall Specificity F1 Score
  • 10. Meaning of Confusion Matrix TP FP FN TN Actual Positives(1) Negatives(0) Positives(1) Negatives(0) Predicted One of the most intuitive and easiest metrics used to find correctness and accuracy Not a performance measure Almost all performance metrics are based on confusion matrix
  • 11. Confusion Matrix : Example Cancer Prediction System There are different approaches that can hep the center predict cancer Okay Let me introduce you to one of the easiest matrices that can help you predict whether a person has cancer, the confusion matrix.
  • 12. Confusion Matrix : Classification Problem How to predict if a person has cancer? Give a label / class to the target variables: When a person is diagnosed with cancer When a person is does not have cancer 1 0
  • 13. Confusion Matrix : Classification Problem TP FP FN TN Actual Positives(1) Negatives(0) Positives(1) Negatives(0) Predicted Sets of classes are given in both dimensions
  • 14. Terms of Confusion Matrix True PositiveTP True Negative TN False Negative FN False PositiveFP TP FP FN TN Actual Positives(1) Negatives(0) Positives(1) Negatives(0) Predicted
  • 15. True Positive True Positive T P T N F N F P True Positives are the cases where the actual class of the data point is 1 (true) and the predicted value is also 1 (true). The case where a person has cancer and the model classifies the case as cancer positive comes under true positive.
  • 16. True Negative True Negative T P T N F N F P True Negatives are the cases when the actual class of the data point is 0 (false) and the predicted is also 0 (false). It is negative because the class predicted was negative. The case where a person does not have cancer and the model classifies the case as cancer negative comes under true negative.
  • 17. False Positive T P T N F N F P False positives are the cases when the actual class of the data point is 0 (false) and the predicted is 1 (true). It is false because the model has predicted incorrectly. The case where a person does not have cancer and the model classifies the case as cancer positive comes under false positive. False Positive
  • 18. False Negative False Negative T P T N F N F P • False negatives are the cases when the actual class of the data point is 1 (true) and the predicted is 0 (false). • It is false because the model has predicted incorrectly. • It is negative because the class predicted was negative. The case where a person has cancer and the model classifies the case as cancer negative comes under false negatives.
  • 19. Minimize False Cases What should be minimised? ✦A model is best identified by its accuracy ✦No rules are defined to identify false cases ✦It depends on business requirements and context of the problem.
  • 20. Minimize False Negative : Example Out of 100 people Actual cancer patients = 5 Bad Model Predicts everyone as non- cancerous Accuracy = 95% When a person who does not have cancer is classified as cancerous Missing a cancer patient will be a huge mistake
  • 21. Minimize False Positive : Example The model needs to classify an email as spam or ham (term used for genuine email). Assign a label / class to the target variables: Email is spam Email is not spam 1 0
  • 22. Minimize False Positive : Example Incoming mail Model In case of false positive Important email as spam ! Business stands a chance to miss an important communication An important email marked as spam is more business critical than diverting a spam email to inbox. Classifies
  • 23. Accuracy In classification problems, accuracy is defined by the total number of correct predictions made out of all the predictions.
  • 24. Accuracy : Calculation TP FP FN TN Actual Positives(1) Negatives(0) Positives(1) Negatives(0) Predicates Accuracy = TP + TN TP + FP + FN + TN
  • 25. Accuracy : Example When the target variable classes in the data are nearly balanced When do we use accuracy?
  • 26. Accuracy : Example The machine learning model will have approximately 97% accuracy in any new predictions.
  • 27. Accuracy : Example 5 out of 100 people have cancer When do you NOT use accuracy? It’s a bad model and predicts every case as noncancerous It classifies 95 noncancerous patients correctly and 5 cancerous patients as noncancerous Accuracy of the model is 95% When the target variable classes in the data are a majority of one class
  • 28. Precision • Refers to the closeness of two or more measurements • Aims at deriving correct proportion of positive identifications
  • 29. Precision : Calculation TP FP FN TN Actual Positives(1) Negatives(0) Positives(1) Negatives(0) Predicates Precision = TP TP + FP
  • 30. Precision : Example Its a bad model and predicts every case as cancer When do we use precision? Everyone has been predicted as having cancer Precision of the model is 5% 5 out of 100 people have cancer
  • 31. Recall or Sensitivity Recall or sensitivity measures the proportion of actual positives and that are correctly identified.
  • 32. Recall or Sensitivity : Calculation TP FP FN TN Actual Positives(1) Negatives(0) Positives(1) Negatives(0) Predicates Recall = TP TP + FN
  • 33. Recall or Sensitivity : Example Predicts every case as cancer When do we use recall? Recall is 100% Precision of the model is 5% 5 out of 100 people have cancer
  • 34. Recall as a Measure When do we use precision and when do we use recall? Precision is about being precise, whereas recall is about capturing all the cases.
  • 35. Recall as a Measure When do we use precision and when do we use recall? If the model captures one correct cancer positive case, it is 100% precise.
  • 36. Recall as a Measure When do we use precision and when do we use recall? If the model captures ever case as cancer positive, you have100% recall.
  • 37. Recall as a Measure When do we use precision and when do we use recall? To focus on minimising false negatives you would want 100% recall with a good precision score.
  • 38. Recall as a Measure When do we use precision and when do we use recall? To focus on minimising false positives you should aim for 100% precision.
  • 39. Specificity • Measures = proportion of actual negatives that are correctly identified • Tries to identify probability of a negative test result when input with a negative example
  • 40. Specificity : Calculation TP FP FN TN Actual Positives(1) Negatives(0) Positives(1) Negatives(0) Predicates Specificity = TN TN + FP
  • 41. Specificity : Example Predicts every case as cancer So specificity is the exact opposite of recall Specificity is 0% 5 out of 100 people have cancer
  • 42. F1 Score Do you have to carry both precision and recall in your pockets every time you make a model to solve a classification problem? No to avoid taking both precision and recall, its best to get a single score (F1 score) that can represent both precision (P) and recall (R).
  • 43. F1 Score : Calculation 3 97 0 0 Actual Fraud Not Fraud Fraud Not Fraud Predicates F1 Score = 2 * Precision * Recall Precision + Recall
  • 44. F1 Score : Example 97 out of 100 credit card transactions are legit and 3 are fraud When do you use F1 score? Predicts everything as fraud Fraud detection
  • 45. F1 Score : Example Precision = 3 100 = 3% Recall = 100 3 = 100% Arithmetic Mean = 3+100 2 = 51.5%
  • 46. Harmonic Mean • Harmonic mean is an average used when x and y are equal • Value of the mean is smaller when x and y are different With reference to the fraud detection example, F1 Score can be calculated as F1 Score = 2 * Precision * Recall Precision + Recall = 2 * 3 * 100 100 + 3 = 5%
  • 47. Key Takeaways ✦Confusion matrix is used to find correctness and accusation of machine learning models. It is also used for classification problems where the output can be one of two or more types of classes. ✦Accuracy is the number of correct prediction made by the model over all kinds of predictions. ✦Precisision refers to the closeness of two or more measurements to each other ✦Recall measures the proportion of actual positives that are identified correctly. ✦Specificity measures the proportion of actual negatives that are identified correctly. ✦F1 Score gives a single score that represents both precision (P) and recall (R). ✦Harmonic mean is used when the sample data contains extreme value because it is more balanced than arithmetic mean.

Editor's Notes

  1. So many algorithms around. How do you decide which is best?
  2. Cancer research
  3. No model is 100% accurate and therefore to be closer to accurate we have to minimise the errors in false cases