A confusion matrix provides a summary of the performance of a classification model by showing the number of true positives, true negatives, false positives, and false negatives. Here's an example code snippet to compute a confusion matrix using scikit-learn:
from sklearn.metrics import confusion_matrix
# Assuming `y_true` and `y_pred` are the true and predicted labels, respectively
cm = confusion_matrix(y_true, y_pred)
print("Confusion Matrix:")
print(cm)