Comments (1)
Hi @ding3820, thanks for raising this issue.
We have evaluated that it will require a large refactor of the codebase to support this feature and we are therefore not going to support it in the near future. If this get requested in the future we may reconsider.
For now, there is a fairly easy way to achieve this in torchmetrics using MetricCollection
:
from torchmetrics import MetricCollection
from torchmetrics.classification import MultilabelAccuracy
import torch
mla = MetricCollection(
{f"accuracy_{i}": MultilabelAccuracy(num_labels=3, average=None, threshold=t) for i, t in enumerate([0.1, 0.5, 0.9])}
)
print(mla)
#MetricCollection(
# (accuracy_0): MultilabelAccuracy()
# (accuracy_1): MultilabelAccuracy()
# (accuracy_2): MultilabelAccuracy()
#)
x = torch.rand(10, 3)
y = torch.randint(0, 2, (10, 3))
mla.update(x, y)
print(mla.compute())
# {'accuracy_0': tensor([0.5000, 0.4000, 0.4000]),
# 'accuracy_1': tensor([0.7000, 0.4000, 0.5000]),
# 'accuracy_2': tensor([0.5000, 0.5000, 0.4000])}
it is a bit slower than if this was implemented directly into the metric but it should still work. Closing issue for now.
from torchmetrics.
Related Issues (20)
- Multi output functionality for MeanAbsoluteError HOT 1
- _cumsum moves the data to default GPU when deterministic flag is on HOT 1
- Retrieval metrics are misleading - here's how it should be done instead HOT 6
- Cannot import the "clustering" module HOT 5
- Potentially Misleading Error Message for multiclass_precision HOT 2
- Accuracy incurs a GPU/CPU sync point HOT 3
- Support equivalent of torcheval's `merge_state` HOT 1
- Multilabel metrics based on threshold should accept a threshold per label
- Recall and Accuracy produce different values when used with logits HOT 1
- Cloning `MultitaskWrapper` with postfix parameters results in incorrect dictionary HOT 5
- f-string should be used in exception HOT 2
- "zero_division" does not work for binary IoU (Jaccard index) calculation and returns NaN HOT 1
- `higher_is_better` for `InfoLM` should change depending on `information_measure` HOT 2
- GPL 2.0 License detected in `functional/text/chrf.py` HOT 3
- truncation cause error while using `bert_score` HOT 3
- `log_dict` to support `ClasswiseWrapper`
- `FrechetInceptionDistance` hangs when used with multiple devices in PytorchLightning HOT 2
- Make `ignore_index` work when all batch elements are to be ignored HOT 1
- procrustes alignment HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torchmetrics.