Hello Everyone,
Welcome to the 25th edition of my newsletter ML & AI Cupcakes!
The agenda of today’s newsletter is given below:
Quick revision of the components of a confusion matrix for binary classification problems.
Construct a confusion matrix with the help of an example.
Test your understanding of constructing a confusion matrix.
Answers of confusion matrix MCQs shared in the last newsletter.
Quick revision of the components of a confusion matrix for binary classification problems
A confusion matrix is used to evaluate the performance of a machine learning model for classification problems.
The confusion matrix for binary classification problems is a 2 x 2 matrix with four components namely True Positives (TPs), False Positives (FPs), True Negatives (TNs) and False Negatives (FNs).
The definition of these four components are given below:
True Positives (TPs): Total number of instances where the actual value is positive and the predicted value is also positive.
False Positives (FPs): Total number of instances where the actual value is negative but the predicted value is positive. This is also known as Type I error.
True Negatives (TNs): Total number of instances where the actual value is negative and the predicted value is also negative.
False Negatives (FNs): Total number of instances where the actual value is positive but the predicted value is negative. This is also known as Type II error.
Construct a confusion matrix with the help of an example
Consider a binary classification problem (10 instances) with two outcome classes say “negative” and “positive”.
The “negative” and “positive” classes are represented by 0 and 1 respectively.
The table below contains the actual value and predicted value for each of the 10 instances.
Now, let’s create a confusion matrix from this table.
For this, you need to follow two steps:
First, apply the definitions of TP, FP, TN, FN for each instance to make a conclusion about the predicted results. Once it is done for all the 10 instances, the following table will be formed.
Based on the above table, fill the entries in the confusion matrix by getting a total of True Positive’s, False Positive’s, True Negative’s, False Negative’s. The following confusion matrix will be formed.
Do you have any doubts here?
Test your understanding of constructing a confusion matrix
Construct a confusion matrix based on the following table and share the values of TPs, FPs, TNs, FNs in the comments section.
Answers of confusion matrix MCQs shared in the last newsletter
Link to the MCQs!
Answers
1)d 2)b 3)a 4)c 5)b 6)c 7)d 8)a 9)b 10)a 11)b 12)c 13)b 14)c 15)a 16)c 17)b 18)b
Curious about a specific AI/ML topic? Let me know in comments.
Also, please share your feedbacks and suggestions. That will help me keep going. Even a “like” on my posts will tell me that my posts are helpful to you.
See you soon!
-Kavita
P.S. Let’s grow our tribe. Know someone who is curious to dive into ML and AI? Share this newsletter with them and invite them to be a part of this exciting learning journey.