Confusion matrix is a performance measurement technique for machine learning which use to evaluate the performance of a classification model. It is a table that lists how many predictions a classifier made correctly and incorrectly. It is employed to evaluate a classification model’s effectiveness. It can be used to calculate performance metrics like accuracy, precision, recall, and F1-score in order to assess the effectiveness of a classification model.
Confusion Matrix has two values:
- Predicted Value
- Actual Value
Actual means it is true and reality. Predicted means what is the assumption for result.
We do the prediction, and result show the actual. It can be false or true as per prediction. There may be difference in what we are visualizing, and what we were realizing.
Let’s suppose one person went to doctor, check if disease Yes or No.
Doctor said: You do not have disease
Predicted: He didn’t had disease.
Means: True Negative
If doctor said that you do not have disease, but he had disease.
Means: False Negative
There are four types of components as True Positive, False Positive, True Negative, and False Negative.
- True Positive (TP): the number of malicious packets that have been correctly classified. A true positive is an outcome where the model correctly predicts the positive class.
- True Negative (TN): the number of packets that have been correctly classified. A true negative is an outcome where the model correctly predicts the negative class.
- False Positive (FP): False positive is where you receive a positive result for a test, when you should have received a negative result. (Type 1 Error or FPR)
- False Negative (FN): A related concept is a false negative, where you receive a negative result when you should have received a positive one. (Type 2 Error or FNR)





