C

Confusion Matrix

CM

A confusion matrix is a tool used to evaluate the performance of a classification model.

What is a Confusion Matrix?

A confusion matrix is a table used to assess the performance of a classification algorithm. It provides a comprehensive view of how well the model is performing by summarizing the results of predictions made by the model.

Components of a Confusion Matrix

A confusion matrix typically consists of four key components:

  • True Positives (TP): The number of instances correctly predicted as positive.
  • True Negatives (TN): The number of instances correctly predicted as negative.
  • False Positives (FP): The number of instances incorrectly predicted as positive (also known as Type I error).
  • False Negatives (FN): The number of instances incorrectly predicted as negative (also known as Type II error).

Understanding the Matrix

The structure of a confusion matrix can be illustrated as follows:

                  Predicted Positive    Predicted Negative
Actual Positive TP FN
Actual Negative FP TN

This layout helps in visualizing the performance of the classification model, allowing for the calculation of various performance metrics.

Performance Metrics

From the values in the confusion matrix, several important performance metrics can be derived:

  • Accuracy: (TP + TN) / (TP + TN + FP + FN)
  • Precision: TP / (TP + FP)
  • Recall (Sensitivity): TP / (TP + FN)
  • F1 Score: 2 * (Precision * Recall) / (Precision + Recall)

These metrics help determine how well a model is performing in terms of correctly identifying positive and negative instances. A well-constructed confusion matrix is essential for understanding the strengths and weaknesses of a classification model.

Ctrl + /