The confusion matrix is a representation of Model classification metrics.

Pasted image 20250321114722.png

Implementation

from sklearn.metrics import classification_report

y_bin_preds = np.array(y_pred) > 0.5
print("Confusion Matrix:\n", classification_report(y_test, y_bin_preds, target_names=["pos", "neg"])) # target names: 0, 1, 2, ..., str labels in that order

Pasted image 20250629120649.png