AUC - ROC Curve
A ROC curve compares true-positive and false-positive rates across score thresholds. AUC summarises ranking behaviour, not the accuracy of one chosen threshold.
Understand the idea
Use scores or estimated probabilities, not already thresholded class labels. Specify which class is positive. A high ROC AUC can coexist with weak precision for a rare positive class, so inspect metrics suited to the prevalence and decision cost. Calibration is another question separate from ranking.
Where to try it
Run locally with scikit-learn and NumPy installed in your virtual environment (py -m pip install scikit-learn numpy). These examples are executed during course review, but the online runner does not currently preload scikit-learn. The small data is for learning the API, not evidence of production model quality.
A worked example
from sklearn.metrics import roc_auc_score
actual = [0, 0, 1, 1]
scores = [0.1, 0.4, 0.35, 0.8]
print(roc_auc_score(actual, scores))
Read the result
The AUC is 0.75 because the positive examples outrank most, but not all, negative-positive pairs.
Try one change
Choose two thresholds and build their confusion matrices to see the tradeoff that a single AUC value hides.
For package options, see the scikit-learn documentation.