Logistic Regression Evaluation
Accuracy alone rarely tells the full story for a classification model - properly evaluating Logistic Regression means looking at several complementary metrics.
The Confusion Matrix
Predicted 0 Predicted 1
Actual 0 TN FP
Actual 1 FN TP
# TP = True Positive, TN = True Negative
# FP = False Positive, FN = False Negative
Key Metrics
Accuracy = (TP + TN) / (TP + TN + FP + FN)
Precision = TP / (TP + FP)
Recall = TP / (TP + FN)
F1 Score = 2 * (Precision * Recall) / (Precision + Recall)
Implementing in Python
from sklearn.metrics import confusion_matrix, classification_report, roc_auc_score
y_pred = model.predict(X_test)
y_proba = model.predict_proba(X_test)[:, 1]
print(confusion_matrix(y_test, y_pred))
print(classification_report(y_test, y_pred))
print("ROC-AUC:", roc_auc_score(y_test, y_proba))
Choosing the Right Metric
Accuracy can be misleading on imbalanced data - for example, in fraud detection, precision and recall matter far more than overall accuracy, since missing a fraud case (false negative) is usually costlier than a false alarm.
ROC-AUC measures how well the model separates classes across all possible thresholds, making it a useful metric independent of the 0.5 cutoff.
Coming Up Next
Next, you'll see where Logistic Regression is actually applied across different industries.