Course contentsShow
← Computer Science
Lesson 2835 of 2,87263. Classical ML AlgorithmsFree lesson

Evaluating Logistic Regression Models

Use accuracy, precision, recall, F1-score, and ROC curves to assess classifier performance.

Evaluating Logistic Regression Models

You'll learn how to measure how well your logistic regression classifier actually performs using multiple complementary metrics.

The Challenge of Classification Evaluation

Unlike regression where you check "how far off" predictions are, classification requires different thinking. A logistic regression model outputs probabilities and class predictions, but saying "85% accurate" tells an incomplete story. What if your spam filter catches 99% of emails but marks half your important messages as spam?

Core Metrics Explained

Accuracy is the fraction of correct predictions overall. Simple, but misleading when classes are imbalanced (e.g., fraud detection where 99% of transactions are legitimate).

Precision answers: "Of all items I predicted as positive, how many truly were?" High precision means few false alarms.

Recall (or sensitivity) answers: "Of all actual positive items, how many did I catch?" High recall means you're not missing positives.

F1-score combines precision and recall into one number using their harmonic mean. It's useful when you need a single metric that balances both concerns.

The ROC Curve

Rather than picking one probability threshold (like 0.5), the ROC curve plots true positive rate (recall) against false positive rate across all possible thresholds. The area under this curve (AUC) summarizes overall classifier quality: 0.5 means random guessing, 1.0 means perfect separation.

Think of it like testing a metal detector's sensitivity dial—turning it up catches more metal (higher recall) but triggers more false alarms (lower precision). The ROC curve shows this tradeoff visually.

Choosing the Right Metric

Use accuracy when classes are balanced. Use precision when false positives are costly (spam filtering). Use recall when missing positives is dangerous (disease screening). Use F1 when you need balance. Use ROC-AUC to evaluate threshold-independent performance.

Key Takeaway: Evaluating logistic regression requires multiple metrics—accuracy, precision, recall, F1-score, and ROC curves—each revealing different aspects of classifier performance for different practical priorities.