Confusion Matrix
مصفوفة الالتباس
Definition
A table that compares the true classes with the predicted classes and shows the numbers of true and false positives and negatives.
Definition
A confusion matrix is a table that tabulates predicted versus actual classes, from which metrics such as accuracy, precision, recall and F1 are derived.
Practical examples
from sklearn.metrics import confusion_matrix
y_true = [1, 1, 1, 0, 0, 1, 0, 1]
y_pred = [1, 0, 1, 0, 1, 1, 0, 0]
print(confusion_matrix(y_true, y_pred))Expected output
[[2 1] [2 3]]
