-
-
Notifications
You must be signed in to change notification settings - Fork 623
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
Possible improvements for Accuracy #1089
Comments
@WeirdKeksButtonK I really appreciate this API ! Thank you very much 👍🏻 |
Hello, I believe I could be assigned to this issue, since I have a PR for it |
@vcarpani sure ! On Github we can not assign any user to the issue but only those from the project or who participated in the conversation here. |
Hi everyone, I would like to try improving this issue. |
Sure @sallycaoyu , please check also all related PRs and mentions. |
For now, I am trying to finish implementing a Does that sound like a good plan? Or would your like Ignite to have a |
@sallycaoyu thanks for the update! I think we can continue with ### before
acc = Accuracy()
acc.attach(evaluator, "acc")
# evaluator outputs y_pred, y as multiclass logits
### after
acc = Accuracy(mode=Accuracy.LOGITS)
acc.attach(evaluator, "acc")
# evaluator outputs y_pred, y as multiclass logits : (N, C), (N, )
acc = Accuracy(mode=Accuracy.LABELS)
acc.attach(evaluator, "acc")
# evaluator outputs y_pred, y as multiclass labels : (N, ), (N, ) etc |
Sure! Suppose we have:
Then, for binary and multilabel data:
For multiclass data:
|
Thanks a lot for the snippet @sallycaoyu ! I have few thoughts about that:
# binary data:
acc = Accuracy(mode='logits', output_transform=lambda x: (x > 0).to(dtype=torch.long))
acc.attach(evaluator, "acc")
# evaluator outputs y_pred, y as binary logits (float in [-inf, inf]): (N, ...), (N, ...), or (N, 1, ...), (N, ...)
What do you think ? |
@vfdev-5 Thank you very much for the comments! I agree that we can drop
|
In full detail the feature request is described here, below is a quick recap.
There are two inconveniences I experience with the current interface of Accuracy.
1. Inconsistent input format for binary classification and multiclass problems
In the first case, Accuracy expects labels as input, whilst in the second case it expects probabilities/logits. I am a somewhat experienced Ignite user and I still get confused by this behavior.
2. No shortcuts for saying "I want to pass logits/probabilities as input"
In practice, I have never used Accuracy in the following manner for binary classification:
Instead, I always do one of the following:
Suggested solution for both problems: let the user explicitly say in which form input will be passed:
The suggested interface can be also extended to support custom thresholds by adding the
__call__
method to the Mode class.The text was updated successfully, but these errors were encountered: