Loading...
Build a confusion matrix for binary classification results.
Given lists of true labels and predicted labels (each 0 or 1), compute the 2x2 confusion matrix:
[TNFNFPTP]
where:
Return the matrix as a 2D list [[TN, FP], [FN, TP]].
y_true = [1, 0, 1, 1, 0, 0] y_pred = [1, 0, 0, 1, 0, 1]
[[2, 1], [1, 2]]
y_true and y_pred lists simultaneously, comparing each pair of true and predicted labels.