ROC curveHow well a model separates two groups.
Cases found against false alarms, at every cut-off a model could use. The higher and further left the curve, the better the model.
- Answers Is the model any good?
- Your data found rate and false alarm rate per cut-off
- Models 1 to about 4
- Sum-up AUC, from 0.5 (guessing) to 1 (perfect)
- Excel and Power BI a line or scatter chart
- Model A: AUC 0.94
- Model B: AUC 0.78
What is an ROC curve?
An ROC curve (receiver operating characteristic) checks a model that sorts cases into two groups, such as customers who will leave and customers who will stay. A model gives each customer a score, and a cut-off decides who counts as "will leave". Every cut-off finds some of the real leavers (found, or true positive rate) and wrongly flags some stayers (false alarms, or false positive rate). The ROC curve plots both for every cut-off. The diagonal is guessing; a good model's curve bends up and to the left.
Two churn models, scored on 1,000 customers. Model A finds far more leavers for the same false alarms: its area under the curve (AUC) is 0.94, against 0.78 for Model B.
Why use an ROC curve?
Because a model's quality should not depend on one cut-off.
- Every cut-off at once. Strict or loose, all in one curve.
- Models compare fairly. The higher curve wins at every cut-off.
- One number. The area under the curve sums it up.
- Choose a cut-off. Pick the point with the trade-off you want.
How does an ROC curve work?
Four steps build an ROC curve.
- Step 1 of 4The squareFalse alarms across, found up, each from 0% to 100%; the diagonal is guessing.
- Step 2 of 4One cut-offAt 0.5, the model finds 80% of leavers with 7% false alarms.
- Model 1: AUC 0.94
- Step 3 of 4Every cut-offStricter cut-offs sit low and left, looser ones high and right.
- Model 1: AUC 0.94
- Step 4 of 4The area under itAUC 0.94: the share of the square under the curve.
- Model 1: AUC 0.94
What are the parts of an ROC curve?
Four parts, and each one has a job.
- Model 1: AUC 0.94
- Curvethe model at every cut-off
- Diagonalguessing
- Cut-offone choice: found and false alarms
- Top leftperfect: everything found, no false alarms
How do you read an ROC curve?
Three looks, in this order.
- Compare with the diagonalThe diagonal is guessing; any useful model bends above it.
- Find the higher curveModel A is above Model B everywhere: AUC 0.94 against 0.78.
- Model A: AUC 0.94
- Model B: AUC 0.78
- Pick a cut-offAt 0.5, Model A finds 80% of leavers with only 7% false alarms.
- Model A: AUC 0.94
- Model B: AUC 0.78
What kinds of ROC curve are there?
The same model, three ways.
- Kind 1CurveEvery cut-off joined.
- Model 1: AUC 0.94
- Kind 2Area shadedThe AUC as a shape.
- Model 1: AUC 0.94
- Kind 3One cut-off markedThe point in use.
- Model 1: AUC 0.94
When the group you look for is rare (fraud, rare diseases), a precision-recall curve is often more telling: it shows how many flagged cases are real, which the ROC curve hides.
When should you use an ROC curve?
When a model sorts cases into two groups and the cut-off is open.
- a model gives scores for two classes
- several models need comparing
- the cut-off is not fixed yet
- both groups are reasonably common
- the cut-off is fixed (a confusion matrix)
- the positive class is rare (a precision-recall curve)
- the business wants to know whom to contact (a lift chart)
ROC curve or confusion matrix?
Every cut-off, or the counts at one.
The ROC curve shows the model at every cut-off. A confusion matrix is one point on it: at cut-off 0.5, Model A found 160 of 200 leavers (80%) and flagged 54 of 800 stayers (7%). The curve helps choose the cut-off; the matrix shows what that choice means in people.
How do you make an ROC curve?
Scores and true groups, in Python, R, Excel or Power BI.
In Python, sklearn.metrics.roc_curve returns the false alarm and found rates for every cut-off, and roc_auc_score the area. In Excel or Power BI, compute both rates for a set of cut-offs (a COUNTIFS or a DAX measure per cut-off, with statistical functions as needed), then draw a scatter chart with lines.
What goes wrong with ROC curves?
The most common mistake, and its fix: trusting AUC when the cases are rare.
| Mistake | Why it hurts | Fix |
|---|---|---|
| AUC on rare classes | Looks great, flags mostly wrong cases | Precision-recall curve |
| Scored on training data | Too good to be true | Score on held-out data |
| AUC alone | Hides the cut-off in use | Mark the chosen point |
| Axes not square | Curves look better or worse | Same scale both ways |
| No diagonal | No sense of guessing | Draw it |
Every chart for “Is the model any good?”
Read on, step by step.
Does it fit your data? Try it.
Paste your table into Chart Compass, say what the chart should show, and see the charts that fit, drawn with your own numbers. It runs in your browser, so the data stays with you.