Modern Deep Learning Foundations
- Labs
- 6
A score becomes a decision only after you choose a threshold
ROC-AUC evaluates how well a classifier ranks positive cases above negative cases across every possible threshold. It does not select the operating threshold for you.
The selected threshold creates the confusion matrix. Moving it changes false positives and false negatives, so the right operating point depends on the cost of each error in the real decision context.
Lesson 5 - Performance Evaluation Metrics
Printed pages 33-40; PDF pages 35-42.
- Confusion Matrix printed pp. 34-36 / PDF pp. 36-38 paragraphs 1-6; Equations 5.2-5.8
- ROC Curve and AUC printed pp. 37-38 / PDF pp. 39-40 paragraphs 1-5; Equation 5.9
- Balanced Accuracy and MCC printed pp. 39-40 / PDF pp. 41-42 closing metric-comparison paragraphs
Evidence and provenance
113 held-out cases; the operating threshold never changes the underlying scores.
Every displayed metric is recomputed in the browser from the selected profile.
Use it to learn threshold trade-offs, then verify the same ideas on the real holdout.
AUC compares rankings; an operating threshold must reflect the cost of false positives and false negatives.
AUC ROC Curve Simulator
Move the decision threshold and see sensitivity, specificity, TPR, FPR, the confusion matrix, the ROC curve, and the AUC score update in real time.
Compare runs instead of trusting one result
Explain what happened, then transfer it
After moving the threshold, explain what changed in TP, FP, TN, FN, recall, and specificity, and why AUC did not change.
Use at least one value or visible change from the experiment.Choose a real screening, fraud, or quality-control decision and justify a threshold policy for it.
Name the new context and the design choice you would make.- Names the stakeholder and decision context
- Specifies the relative cost of FP and FN
- Chooses and justifies an operating threshold
- States a limitation or monitoring condition
By the end of this lesson, you will be able to:
- Calculate and interpret accuracy, precision, recall, specificity, and F1 from a confusion matrix.
- Explain how changing the decision threshold alters classification outcomes and operating trade-offs.
- Interpret a ROC curve and distinguish threshold-independent AUC from one selected operating point.
In the previous lessons, we built a neural network, trained it on real data, updated weights using gradients, and selected an optimizer. Now it is time to ask a critical question: how do we know if our model is actually good? The goal of machine learning is not to memorize training data, but to generalize - that is, to perform well on new, unseen data. This ability is known as the model's generalization ability, and it is the central measure of any predictive system.
Leave with inspectable evidence, not a completion click
Your artifact combines the prerequisite check, prediction, experiment configuration, displayed evidence, explanation, transfer rubric, and confidence change.
Retrieve the concept after time has passed
Complete the artifact to schedule a 24-hour retrieval prompt and a seven-day transfer revisit.
Help evaluate whether the laboratory teaches the concept
No name, email address, free text, or IP address is retained in the learning record.
Learn the AUC ROC Curve by Moving the Threshold
This AUC-ROC Simulator turns model-evaluation metrics into a live experiment. Move the decision threshold and watch sensitivity, specificity, false-positive rate, the confusion matrix, the selected ROC point, and the AUC score respond together.
What the ROC curve shows
The receiver operating characteristic curve plots true-positive rate against false-positive rate across classification thresholds. Each point represents a different operating decision.
What the AUC score measures
Area under the ROC curve summarizes how well prediction scores rank positive cases above negative cases. It evaluates the score ordering across thresholds, not one confusion matrix.
Why the threshold matters
Changing the threshold changes false positives, false negatives, recall, and specificity. Use the simulator to choose an operating point that matches the real cost of each error.
AUC ROC FAQ
What is AUC ROC?
ROC is the curve of true-positive rate versus false-positive rate across thresholds. AUC is the area under that curve and summarizes ranking discrimination in a single value.
Does changing the decision threshold change AUC?
Not when the underlying prediction scores stay the same. The threshold changes the operating point and confusion matrix; AUC summarizes the ranking across all thresholds.
What is a good AUC score?
An AUC of 0.5 reflects random ordering and values closer to 1 indicate stronger discrimination. A useful score still depends on the dataset, error costs, calibration, and deployment context.
When should ROC AUC be used?
Use ROC AUC to compare binary classifiers across thresholds. For heavily imbalanced problems, also inspect precision-recall behaviour and select a threshold using the real costs of false positives and false negatives.
Is there a minimum sample size for AUC ROC?
There is no universal minimum. AUC can be calculated when the test set contains at least one positive and one negative case, but estimates from small samples are unstable. Use an independent test set with enough cases in each class and report a confidence interval.
What does an AUC below 0.5 mean?
It means the scores tend to rank negative cases above positive cases. Check whether labels or score direction were reversed, then investigate data leakage, distribution shift, or a pipeline error. Reversing the score direction changes AUC to approximately 1 minus the original value.
How is ROC AUC used with more than two classes?
Compute class-level AUC with one-vs-rest or pairwise AUC with one-vs-one, then aggregate it. Macro averaging weights classes equally, weighted averaging uses class support, and micro averaging pools decisions. Always report the strategy and averaging method.
Does ROC AUC measure probability calibration?
No. A model can rank cases well and still produce poorly calibrated probabilities. Evaluate calibration separately with a reliability diagram, calibration error, log loss, or Brier score.
How should uncertainty in AUC be reported?
Report a confidence interval from a suitable method such as bootstrap resampling or DeLong's method on an independent test set. When comparing models on the same cases, use a paired comparison rather than treating the AUC estimates as independent.
Is ROC AUC enough for imbalanced classes?
Not always. ROC AUC is relatively insensitive to class prevalence and can look strong while precision is poor for a rare positive class. Also inspect the precision-recall curve, PR AUC, class-specific errors, and the operating threshold required in deployment.