A confusion matrix shows how your model's predictions compare to actual values in a 2x2 table. It breaks down into four parts: True Positives and True Negatives are correct predictions, while False Positives and False Negatives are the mistakes that tell you where your model needs work.
Chapters
Let us understand what is confusion matrix, and it is very important to learn about confusion matrix when you are working with machine learning model and you want to know the performance of your machine learning model. Generally, this confusion matrix looks something like this, which is TP, TN, FP, and TN. And on the row side, it is actual values, and on the column side, they are predicted values. So you can easily understand this graph if you understand these terms. TP, FP, FN, and TN— what is TP? TP is true positive. It means those value which are correctly predicted positive. It means those which were actually correct and are predicted also correctly. Next is false positive. It means incorrectly predicted positive. It means actually they were not positive but they were predicted positive. Now FN, false negative, it means incorrectly predicted negative. Same way we have TN, which is true negative, which is correctly predicted negative. It means actually they were negative and in the result also in the prediction also we are getting it negative. So it is important because if you want to optimize your model, you want to improve the performance of your model, confusion metric plays a major role in that. If you want to improve the model and also identify the errors which are in FP and FN