You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect that top_k should impact accuracy, even in micro mode -- namely, in that top_k should mean that you get a prediction "correct" if the "right" logit is among the "top top_k" scores, then you average the number of corrects as per usual. This is not the behavior I see with torchmetrics now. Instead, I see this:
I think it is actually the case that it doesn't work as expected in any multiclass setting. It may be working as the developers intended, and just an issue with my expectations, but I would expect top-k in multiclass to consider a prediction correct if any of the top-k predictions were correct, then average those # of corrects. I'm not really sure what it is doing now.
🐛 Bug
I expect that
top_k
should impact accuracy, even in micro mode -- namely, in thattop_k
should mean that you get a prediction "correct" if the "right" logit is among the "toptop_k
" scores, then you average the number of corrects as per usual. This is not the behavior I see with torchmetrics now. Instead, I see this:Expected behavior
I would expect to see all accuracies with top_k >= 2 to be 1.0.
Additional context
This line https://github.com/Lightning-AI/torchmetrics/blob/master/src/torchmetrics/functional/classification/accuracy.py#L85 ignores
top_k
in the micro case.I think the fix to this issue may be related: #3037
The text was updated successfully, but these errors were encountered: