AI Terms Dictionary

A comprehensive multilingual AI terminology dictionary

Definition

A confusion matrix is a specific table layout that allows visualization of the performance of an algorithm, typically a supervised learning one. It shows the counts of true positive, true negative, false positive, and false negative predictions. This structure helps in understanding where the model is making errors, providing insights beyond simple accuracy metrics, especially in imbalanced datasets. It serves as the foundation for calculating precision, recall, and F1 scores.

Summary

A table used to describe the performance of a classification model on a set of test data.

Key Concepts

Use Cases

Code Example

1
2
3
4
from sklearn.metrics import confusion_matrix
y_true = [2, 0, 2, 2, 0, 1]
y_pred = [0, 0, 2, 2, 0, 2]
print(confusion_matrix(y_true, y_pred))