We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://lightning.ai/docs/torchmetrics/stable/classification/dice.html
Here, under average parameter of the dice score, there is the option of 'weighted' mentioned. But that triggers an error while using it.
!pip install torchmetrics from torch import tensor from torchmetrics.classification import Dice preds = tensor([2, 0, 2, 1]) target = tensor([1, 1, 2, 0]) dice = Dice(average='weighted') dice(preds, target)
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) [<ipython-input-4-16f87eeaf06b>](https://localhost:8080/#) in <cell line: 6>() 4 preds = tensor([2, 0, 2, 1]) 5 target = tensor([1, 1, 2, 0]) ----> 6 dice = Dice(average='weighted') 7 dice(preds, target) [/usr/local/lib/python3.10/dist-packages/torchmetrics/classification/dice.py](https://localhost:8080/#) in __init__(self, zero_division, num_classes, threshold, average, mdmc_average, ignore_index, top_k, multiclass, **kwargs) 158 allowed_average = ("micro", "macro", "samples", "none", None) 159 if average not in allowed_average: --> 160 raise ValueError(f"The `average` has to be one of {allowed_average}, got {average}.") 161 162 _reduce_options = (AverageMethod.WEIGHTED, AverageMethod.NONE, None) ValueError: The `average` has to be one of ('micro', 'macro', 'samples', 'none', None), got weighted.
Google Colab -> (Hence the pip install)
https://colab.research.google.com/drive/1GuBr6kI0ypj0sUDaqGQ8dN0Td-sbYWGI?usp=sharing
The text was updated successfully, but these errors were encountered:
Hi! thanks for your contribution!, great first issue!
Sorry, something went wrong.
I see the issue
Its in the doc string, but not within the code. I guess weighted is not supported (?)
torchmetrics/src/torchmetrics/classification/dice.py
Line 71 in a68455a
Line 158 in a68455a
Looks like most of the weighted code was removed
2509448
Great Find. Thank you. Will keep the issue open for the time-being.
I think this shall be fixed in the docs, @SkafteNicki thoughts?
No branches or pull requests
Bug description
https://lightning.ai/docs/torchmetrics/stable/classification/dice.html
Here, under average parameter of the dice score, there is the option of 'weighted' mentioned. But that triggers an error while using it.
How to reproduce the bug
Error messages and logs
Environment
Google Colab -> (Hence the pip install)
More info
https://colab.research.google.com/drive/1GuBr6kI0ypj0sUDaqGQ8dN0Td-sbYWGI?usp=sharing
The text was updated successfully, but these errors were encountered: