Confusion matrix

The confusion matrix cross-tabulates true and predicted classes. For a binary problem, it counts true positives, false positives, true negatives, and false negatives. All classification metrics (precision, recall, accuracy) are derived from it; it shows which types of errors the model makes.

Example

confusion_matrix(y_test, pred)

Related concepts

The whole glossary