Confusion Matrix in Machine Learning
So, first thing first. What is Confusion Matrix?
- In simple terms confusion matrix is a performance measurement for a machine learning problem.
So our main aim in this blog is to understand what is confusion matrix and how to calculate it.
So how does a confusion matrix looks like-
With the help of confusion matrix we can get crucial results(Recall, Precision and so on)about our model.
Note: To understand better I am taking an example of 2 class problem. Say +,-
First let’s understand TP,FP,FN,TN-
TP — True Positive : Your model predicted + and actually its +.
FP — False Positive : Your model predicted + but actually its -.
FN — False Negative : Your model predicted- but actually its +.
TN — True Negative : Your model predicted- and actually its -.
So, lets begin with calculation part by a simple example -
As per the example we will calculate Recall, Precision and Accuracy-
Recall
So, Recall = 2/3 = 0.66667
- Out of all the positive classes, how much we predicted correctly. It should be high as possible.
Precision
So, Precision = 2/3 = 0.6667
- Out of all the positive classes we have predicted correctly, how many are actually positive.
Accuracy
Accuracy = 5/7
Simply means how many we predicted correctly. It should be as high as possible.
F-measure
So, F-measure = 0.6667
- F-Measure is Harmonic Mean of Recall and Precision.
- Measure Recall and Precision at same time.
So, I hope I was able to deliver the basics of Confusion Matrix to you.
If you like this post you can motivate me by some 👏.
Lets meet in some other article.