Evaluation metrics play an important role in achieving the optimal model during model training. It is a way to quantify the performance of the Machine learning Model.
For simplicity, I'll be focusing on binary classification. But all the below metrics can be extended for multi-class classification. Let us first understand the basic building block of metrics used to evaluate a classification model. Suppose we have trained a binary image classifier model that predicts whether there is a cat or not in the image.
Positive Class: Cat is a Positive class.
Negative Class: No Cat is the Negative class, It can be anything(dog, horse, background, etc.) except cat in the image.
Fig. 1 |
Fig. 2 |
- True Positive (TP): It is an outcome when the model correctly predicts the positive class. i.e the actual image is "Cat" and the model also predicts "Cat".
- False Positive (FP): It is an outcome when the model incorrectly predicts the positive class. i.e the actual image is "Cat" but the model predicts it a "Not Cat".
- True Negative (TN): It is an outcome when the model correctly predicts the negative class. i.e the actual image is a "Not Cat" and the model also predicts it a "Cat".
- False Negative (FN): It is an outcome when the model incorrectly predicts the negative class. i.e the actual image is a "Cat" but the model predicts it as a "Not Cat".
Classification Accuracy
It is the ratio of correct prediction to the total number of samples.
Example: If we have 150 testing samples, and our classifier predicts 120 samples correctly. Then accuracy is 120/150 i.e 0.8 or 80%.
For a binary classification problem, accuracy can also be defined as
Recall
It is the total number of TP divided by actual positives( TP + FN ).
From the above equation, we can infer the following points
Precision
For a binary classification problem, accuracy can also be defined as
Recall
\[Recall=\frac{TP}{TP+FN}\]
It is the total number of TP divided by actual positives( TP + FN ).
From the above equation, we can infer the following points
- If a model is not producing any False Negative then recall is 1.
- If a model is not producing any True Positive then recall is 0.
\[Precision =\frac{TP}{TP+FP}\]
It is the total number of TP divide by the total number of predicted positives( TP + FP ).
From the above equation, we can infer the following points
- If a model is not producing any False Positive then precision is 1.
- If a model is not producing any True Positive then precision is 0.
F1 Score
\[F1=2 . \frac{Precision . Recall }{Precision + Recall }\]
It is the harmonic mean of precision and recall.
Confusion Matrix
It is also known as error Matrix, The term 'confusion' is used because it checks if the system is getting confused between classes. It gives more insight into the performance of a classification model. Fig. 2 is a matrix for multi class classification problems.
Let's again take an example of multi-class classification problem where confusion matrix helps a lot in understanding the performance and cause of error in our trained model.
If we have a trained model on CIFAR-10 data, and perform classification on test dataset. The confusion matrix is plotted in Fig.3
Let's again take an example of multi-class classification problem where confusion matrix helps a lot in understanding the performance and cause of error in our trained model.
If we have a trained model on CIFAR-10 data, and perform classification on test dataset. The confusion matrix is plotted in Fig.3
- The vertical axis denotes the actual class and horizontal axis denotes the predicted class.
- The sum of all the numbers in any row reflects the total number of images used for testing of corresponding class. Sum of all values in any row is 1000 because we have used 1000 samples of each class for testing.
- The sum of all the numbers in any column reflects the total number of prediction for corresponding class.
Now, look at the first row corresponding to "Cat" class. We can infer that 826 samples are predicted as "Cat",48 are predicted as "Dog", 12 are predicted as "Horse" and so on... all of which are actually "Cat". It means we have predicted 826 samples correctly.
We can also infer that Cat is getting confused mostly with "Dog".
From second row we can infer that 801 "Dog" images samples are correclty predicted, but 111 samples of "Dog" are predicted as "Cat".
From this we infer that "Cat" and "Dog" are confused with each other, and our accuracy is dropping beacause of this isssue.
Using the above insights we can do necessary changes in our model and data.
Thanks for reading.
Using the above insights we can do necessary changes in our model and data.
Thanks for reading.
Good Explanation ,I got to know more
ReplyDeleteWonderful Blog post!!! I am more impressed with your data.
ReplyDeleteMachine Learning Training in Chennai
Best Machine Learning Course Online
Machine Learning Training in Bangalore
This blog is a great source of information which is very useful for me.
ReplyDeleteSoftware testing training in Tambaram
Software testing training in Anna Nagar
Software testing training in T Nagar
Software testing training in Porur
Software testing training in OMR
Software testing training in chennai
This blog is a great source of information which is very useful for me.
ReplyDeleteSales force Training in Chennai
Sales force course in Chennai
React JS training
Spoken English course training
More valuable post!!! Thanks for sharing this great post with us.
ReplyDeleteInformatica course in Chennai
Web Designing Training in Chennai
Salesforce Training in Chennai
ReplyDeleteAwesome blog. Thanks for sharing this blog. Keep update like this...
Android Training in Bangalore
Android Classes in Pune
Android Classes in Hyderabad
Android Training in Gurgaon
Great post. keep sharing such a worthy information
ReplyDeletePHP Training in Chennai PHP Training in Bangalore
Informative blog... Thanks for sharing and keep updating
ReplyDeleteHacking Course in Chennai
Ethical Hacking Training in Bangalore
Informative blog... Thanks for sharing and keep updating
ReplyDeleteAndroid Training in Velachery
Oracle DBA Training in Velachery
Java Training in Velachery
Great post. keep sharing such a worthy information
ReplyDeleteSales Force CPQ Online Training Hyderabad
Visit us: sales force CPQ Online Training
Great post. keep sharing such a worthy information
ReplyDeleteBig data training in chennai
Big Data Course in Chennai
Great post. keep sharing such a worthy information
ReplyDeleteDigital Marketing Training in Chennai
Digital marketing online course
Great post.. thanks for sharing
ReplyDeleteSpoken English Classes in Chennai
Best Spoken English Classes in Chennai
Spoken English in Chennai
English Speaking Course in Chennai
Best English Coaching Centre in Chennai
Spoken English Course in Chennai
Nice info!
ReplyDeleteRPA course in Chennai
Rpa training online
Good Blog.. keep more updates
ReplyDeleteData Science Course in Chennai
Data Science Training in Chennai
Data Science Certification in Chennai
Data Science Courses in Bangalore
Data Science Training in Bangalore
This is a good site and a really nice point of view.I learned lots of useful information.Social Media Training in Chennai
ReplyDeleteSocial Media Training Institute in Chennai
ReplyDeleteGreat Blog! very useful and informative keep updating like this.
DOT NET Training in Chennai
Dot Net Training Online
DOT NET Training in Bangalore
This comment has been removed by the author.
ReplyDeleteBDD with Cucumber Online Training
ReplyDeleteGreat blog.thanks for sharing such a useful information
ReplyDeleteJava training chennai
Great blog.Thanks for sharing such a useful information.share more.
ReplyDeleteBDD with Cucumber Online Course
BDD with Cucumber Online Training
Great blog. Thanks for sharing such a useful information. Share more.
ReplyDeleteJira Training Online
Jira Course Online
Excellent Blog to read. You have shared a useful information. Thank you.
ReplyDeleteRanorex Test Automation Course Online
Ranorex Test Automation Online Course
Extraordinary Blog. Provides necessary information.
ReplyDeleteDot Net Online Certification Training
Dot Net Online Training Course
Really nice blog. thanks for sharing
ReplyDeletebest selenium training in chennai
Best selenium Training Institute in Chennai
Happy to read the informative blog. Thanks for sharing
ReplyDeletebest german language institute in chennai
best german classes in chennai
Great post. keep sharing such a worthy information.
ReplyDeleteArtificial Intelligence Course in Chennai
Best AI Courses Online
Artificial Intelligence Course In Bangalore
This post is so interactive and informative.keep update more information...
ReplyDeleteWeb Designing Course in Tambaram
Web Designing Course in chennai
ReplyDeleteThis post is so interactive and informative.keep update more information...
Digital Marketing Course in Tambaram
Digital Marketing Course in Chennai
This post is so interactive and informative.keep update more information...
ReplyDeletegraphic design courses in tambaram
graphic design courses in Chennai
ReplyDeleteThis post is so interactive and informative.keep update more information...
DevOps course in Tambaram
DevOps Training in Chennai
Great post. keep sharing such a worthy information.
ReplyDeleteBest IELTS Coaching Centre In Chennai