New paste Repaste Download
#Compare the results in terms of accuracy, precision and recall
from sklearn.metrics import accuracy_score, precision_score, recall_score
accuracy_log = accuracy_score(y_test, y_pred_log)
precision_log = precision_score(y_test, y_pred_log)
recall_log = recall_score(y_test, y_pred_log)
accuracy_knn = accuracy_score(y_test, y_pred_knn)
precision_knn = precision_score(y_test, y_pred_knn)
recall_knn = recall_score(y_test, y_pred_knn)
print("Comparison of Models:")
print(f"{'Model':<20}{'Accuracy':<10}{'Precision':<10}{'Recall':<10}")
print(f"{'Logistic Regression':<20}{accuracy_log:.2f}      {precision_log:.2f}      {recall_log:.2f}")
print(f"{'KNN':<20}{accuracy_knn:.2f}      {precision_knn:.2f}      {recall_knn:.2f}")
Filename: None. Size: 754b. View raw, , hex, or download this file.

This paste expires on 2025-06-03 07:11:56.246077. Pasted through web.