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

Implement Enum for task in classification metrics #1478

Closed
SkafteNicki opened this issue Feb 3, 2023 · 0 comments · Fixed by #1479
Closed

Implement Enum for task in classification metrics #1478

SkafteNicki opened this issue Feb 3, 2023 · 0 comments · Fixed by #1479
Labels
enhancement New feature or request

Comments

@SkafteNicki
Copy link
Member

SkafteNicki commented Feb 3, 2023

🚀 Feature

Convert the if, elif statements that use the task argument in classification metrics to instead be a Enum type comparison.
Concrete example:
https://github.com/Lightning-AI/metrics/blob/0caec8f09bfd3ddeb11f0130b3f330bf4b39654c/src/torchmetrics/classification/accuracy.py#L456-L467

Motivation

As reported in this PR #1474 (comment) a simple spelling mistake can lead to this comparison not working. Converting to Enum should hopefully make it more safe.

Alternatives

Additional context

@SkafteNicki SkafteNicki added the enhancement New feature or request label Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant