What is the Confusion Matrix?
Let’s say we have some features in a dataset. We have the petal length, petal width, sepal length, and sepal width of a flower. And based on these features we need to classify the type of flower. If the output is True, the flower is of type 1. And if the output is False, the flower is of type 2.
Now, we ran a machine learning model on the data and obtained the following output:
Y = [True, False, True, True, False, False, True, False, False, True]
And as per the actual classification, the expected output is:
Ya = [False, False, True, True, True, False, True, False, False, True]
So, how well did the model perform? To determine that, we need to measure the performance of the model. One way to measure the performance of a model in a classification problem is to calculate the confusion matrix.
But, before we understand the confusion matrix, we need to understand some terms. They are True Positive (TP), True Negative (TN), False Positive (FP), and False Negative (FN).
True Positives (TP): True positives are those output labels that are predicted to be True and are actually True.
True Negatives (TN): True negatives are the output labels that are predicted to be False and are actually False also.
False Positives (FP): False positives are the output labels that are predicted to be True but are actually False.
False Negatives (FN): False negatives are those output labels that are predicted to be False but are actually True.
A confusion matrix can be represented as follows: …






0 Comments