Classification Raport
Last updated
from sklearn.metrics import accuraccy, classification_reporttarget_names = ['ham', 'spam'] accuracy = accuracy_score(y_test, y_pred)
print("Accuracy: " + accuracy)
# Output:
# Accuracy: 0.9999415592005299report = classification_report(y_test, y_pred, target_names=target_names)
print(report)
# Output:
# precision recall f1-score support
#
# 0 1.00 1.00 1.00 51126
# 1 0.99 1.00 0.99 208
# accuracy 1.00 51334
# macro avg 0.99 1.00 1.00 51334
# weighted avg 1.00 1.00 1.00 51334from sklearn.metrics import accuracy_score, classification_report
target_names = ["Class 1", "Class 2", "Class 3"]
accuracy = accuracy_score(y_test, y_predicted)
report = classification_report(y_test, y_predicted, target_names=target_names)
print(accuracy)
print(report)