import numpy as np
from sklearn.metrics import confusion_matrix, accuracy_score, precision_score, recall_score, f1_score
# Example predictions and actual values
y_true = np.array(['spam', 'not_spam', 'spam', 'not_spam', 'spam', 'not_spam', 'spam', 'spam'])
y_pred = np.array(['spam', 'not_spam', 'not_spam', 'not_spam', 'spam', 'spam', 'spam', 'spam'])
# Create confusion matrix
conf_matrix = confusion_matrix(y_true, y_pred, labels=['spam', 'not_spam'])
print("Confusion Matrix:")
print(conf_matrix)