Confusion Matrix

A confusion matrix is a table used to summarize and assess the success of a Classification model by comparing its predicted labels against actual ground truth labels.

📊 All classification metrics derive from this matrix:

1. Structure and Building a Confusion Matrix

In a binary Classification problem (where there are two classes, often designated as positive and negative), the confusion matrix is a 2x2 table. While conventions can vary slightly, most common implementations (such as scikit-learn) use rows to represent actual classes and columns to represent predicted classes. (Note: some sources reverse this, using columns for ground truth).

Pasted image 20260319021025.png

The matrix is built by counting model outcomes in four categories:

For multiclass Classification, the matrix expands to a K×K grid for K classes. For example, in a 10-digit Classification task, the matrix would be 10x10, with the main diagonal representing correctly identified digits.

2. How to Interpret the Matrix

Powered by Forestry.md