How it works
The ROC curve is a plot of the true positive rate against the false positive rate for every possible threshold of a binary classifier. For each threshold you mark a point on the graph and connecting the points gives you the curve. The area under the curve summarizes performance in a single number. The true positive rate is the share of positive cases correctly found; the false positive rate is the share of negatives the system incorrectly classifies as positive. Each point on the graph represents a different threshold, and moving along the curve shows how the model's behavior changes. The area calculation uses the ranking of probabilities and does not depend on a fixed threshold.
Practical example
Imagine a fraud detection system. With a low threshold the system flags many transactions and catches most fraud, but it generates many false positives. With a high threshold the system is conservative and makes more false negatives. The ROC curve shows the trade-off between these scenarios without running the model again, and the point on the graph closest to the top left corner indicates a good balance between catching fraud and not bothering legitimate customers. When comparing two models, the one with the higher AUC tends to be better overall, but the final choice depends on the cost of each type of error in the real application.
What it's for
The ROC curve is used to compare classifiers and choose an operating threshold that matches the cost of decisions. It also helps justify model selection for production, especially when false positives and false negatives have different weights. The chart lets you compare two models on the same screen without relying on a single threshold, which makes the decision more transparent for the team. Many teams track the curve to decide whether to reduce false positives or false negatives, depending on the risk of each error.
Difference between X and Y
The confusion matrix uses a fixed threshold; the ROC curve varies the threshold. The ROC curve does not account for class prevalence, so for imbalanced datasets other metrics can be more informative.