Introduction to Confusion Matrix
After data cleaning and pre-processing, the first step we do is to feed the data to the ML model. But we need to measure the effectiveness of our model. Better the effectiveness, better the performance and that’s exactly what we want. And it is where the Confusion matrix comes into play. Confusion Matrix is a performance measurement for machine learning classification.
What is Confusion Matrix?
It is a performance measurement for machine learning classification problem where output can be two or more classes. It is a table with 4 different combinations of predicted and actual values.
It is extremely useful for measuring Recall, Precision, Specificity, Accuracy and most importantly AUC-ROC Curve. Now let’s understand TP, FP, FN, TN in terms of pregnancy analogy.
✅ True Positive:
Interpretation: You predicted positive and it’s true.
Example: You predicted that a woman is pregnant and she actually is.
✅ True Negative:
b You predicted negative and it’s true.
Example: You predicted that a man is not pregnant and he actually is not.
✅ False Positive: (Type 1 Error)
Interpretation: You predicted positive and it’s false.
Example: You predicted that a man is pregnant but he actually is not.
✅ False Negative: (Type 2 Error)
Interpretation: You predicted negative and it’s false.
Example: You predicted that a woman is not pregnant but she actually is.
Cyber-attacks have become one of the biggest problems of the world. They cause serious financial damages to countries and people every day. The increase in cyber-attacks also brings along cyber-crime. The key factors in the fight against crime and criminals are identifying the perpetrators of cyber-crime and understanding the methods of attack. Detecting and avoiding cyber-attacks are difficult tasks. However, researchers have recently been solving these problems by developing security models and making predictions through artificial intelligence methods.
The above 2 types of error(Type 1 and Type 2) is very critical in cyber security. Here is an example. Consider a face recognition system which is installed infront of the data warehouse which holds critical error. Consider that the manager comes and the recognition system is unable to recognize him. He tries to log in again and is allowed in.
Let’s consider another condition. A new person comes and tries to log himself in. The recognition system makes and error and allows him in. Now, this is very dangerous. An unauthorized person has made an entry. This could be very damaging to the whole company.
In both the cases there was an error in the face recognition system. This shows the critical nature that might vary according to situation and condition where we want a tradeoff between the two types of error.