# Ugly AUC curves. Sklearn. How to make AUC Curves less square

I dislike the square look of this AUC curve (SKLearn).

The purpose of this question is "visual". Please post code snippets.

This question is not requesting the theory behind the AUC.

# My goal is to make the curve look like a curve. Right now, the curve looks like a square.

Please refer to the sample code below.

precision, recall, _ = metrics.roc_curve(y_test, pos_probs)
plt.plot(precision , recall, marker='.')
plt.show()

RocCurveDisplay.from_predictions(y_test, pos_probs)


# The curve appearance I want to achieve (red line only).

• You could make up data until you get the curve you want. (That was a joke; don’t do that.) Aside from that, the curve looks how it looks. I’m not following the issue here. Could you please explain and clarify?
– Dave
Feb 16, 2023 at 23:49
• @Dave The red curve is what I want. The blue curve is what I am getting. Feb 16, 2023 at 23:51
• You get what the data support. What’s the problem?
– Dave
Feb 16, 2023 at 23:51
• @Dave Correct. I understand that. Is there a method or are you aware of a method to make the AUC curve less square-ish? For example, adding additional plotting points without altering the final outcome. For example, when you do line charts/histograms in matplotlib, you can use a log method to "soften" (less square) the line appearance. Feb 16, 2023 at 23:55
• More data Will give a less square result Feb 17, 2023 at 3:06

As Dave and Thiago are saying in the comments, the shape of the ROC curve depends on the data, especially the number of possible thresholds in the data.

(it's not called AUC curve btw, AUC stands for "Area Under Curve")

Here you can find an explanation about how the ROC curve is defined, which explains why it has a particular shape.

Your curve looks as if there are only 3 points, including the two extremes. You're right that this is not typical.

• Imho the most likely is an error: check the values in pos_probs, because apparently they have only a few distinct values. Are these values obtained with predict or predict_proba? It should be the latter (common mistake, see here for instance).
• Otherwise it's a matter of too few different points in the data: how many instances do you have? Are the instances diverse enough? If you only have a couple distinct instances, then this kind of curve would be normal. If so, making the curve artificially similar to the red line would be a mistake.