Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All metrics computing a curve should always send back result in the order Xaxis - Yaxis - Everything_Else #2200

Closed
Yann-CV opened this issue Nov 3, 2023 · 2 comments
Labels
bug / fix Something isn't working help wanted Extra attention is needed v1.2.x

Comments

@Yann-CV
Copy link

Yann-CV commented Nov 3, 2023

🐛 Bug

The metrics giving access to curve are not always returning Xaxis - Yaxis in the same order (considering the common usage of the curve).

To Reproduce

pred = torch.tensor([0, 0.1, 0.8, 0.4])
target = torch.tensor([0, 1, 1, 0])

roc = ROC(task="binary")
fpr, tpr, thresholds = roc(pred, target) # in ROC curve Xaxis = fpr -------- Yaxis = tpr

pr_curve = PrecisionRecallCurve(task="binary")
precision, recall, thresholds = pr_curve(pred, target) # in precision recall curve Xaxis = recall -------- Yaxis = precision

Expected behavior

pred = torch.tensor([0, 0.1, 0.8, 0.4])
target = torch.tensor([0, 1, 1, 0])

roc = ROC(task="binary")
fpr, tpr, thresholds = roc(pred, target) # in ROC curve Xaxis = fpr -------- Yaxis = tpr

pr_curve = PrecisionRecallCurve(task="binary")
recall, precision, thresholds = pr_curve(pred, target) # in precision recall curve Xaxis = recall -------- Yaxis = precision

Environment

TorchMetrics 1.2

Additional context

We are trying to be metric agnostic during automated plot creation.
So far we added a constant object:

METRIC_AXIS = {
     ROC: {"x": 0, "y": 1},
     PrecisionRecallCurve: {"x": 1, "y": 0},
}
@Yann-CV Yann-CV added bug / fix Something isn't working help wanted Extra attention is needed labels Nov 3, 2023
@Borda Borda added the v1.2.x label Nov 3, 2023
@SkafteNicki
Copy link
Member

@Yann-CV
Copy link
Author

Yann-CV commented Nov 24, 2023

@SkafteNicki see #2207 (comment) (thanks again for the answer)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / fix Something isn't working help wanted Extra attention is needed v1.2.x
Projects
None yet
Development

No branches or pull requests

3 participants