Comments (2)
Hi! thanks for your contribution!, great first issue!
from torchmetrics.
Hi @gui-miotto, thanks for raising this issue.
In general we do not make any guarantees regarding metrics in torchmetrics what happens when .compute
is called before .update
(or forward
). That the accuracy metric happens to just give a warning and return 0 is just arbitrary. One could make the argument that the accuracy metric should actually crash because the score is clearly undefined if no input have been seen. The same argument is true for average precision score.
Specifically, for average precision metric you can actually just set the thresholds
argument and you will get a warning and returned value of zero:
print(MulticlassAveragePrecision(num_classes=3, thresholds=100).compute()) # prints tensor(0.)
why does this not crash? Because the default value of thresholds=None
means that we are dynamically calculating the thresholds values based on input to the metric. No input to the metric no meaningful thresholds to compute. Does it then make sense to when thresholds=100
to return 0? Not really because, again all the calculations are undefined.
I therefore keep the stance that in general we cannot make sure that metrics where no input is provided can actually succeed with the calculation, which is exactly what the warning we are giving to the user before the program crashes indicates.
from torchmetrics.
Related Issues (20)
- RetrievalNormalizedDCG doesn't change with different top_k values HOT 2
- BootStrapper.update/forward don't process kwargs HOT 1
- List Metric synchronization fails in corner case HOT 1
- Contribution: Add new audio/speech metrics for generative audio HOT 4
- ClasswiseWrapper and JaccardIndex confmat attribute error HOT 2
- Metric not moved to device and invalids the cpu-gpu offloading when combining with DeepSpeed HOT 1
- [Bug] No backend type associated with device type cpu HOT 2
- Metrics not being logged properly on remote GPU HOT 4
- Retrieval Metrics GPU Memory Leak HOT 4
- Specificity if TN + FN = 0 HOT 1
- Building the docs HOT 2
- Discrepancy in optimal threshold calculation between sklearn and torchmetrics ROC implementations HOT 2
- Mean Average Detection ignores `warn_on_many_detections` set to False HOT 1
- `list` states leak (`Tensor`) memory HOT 1
- Behaviors of AUROC and Average Precision are inconsistent when all labels are equal HOT 4
- The default value of `compute_with_cache` should be `True` . HOT 2
- Bug in ERGAS HOT 2
- Ordinal classification metrics HOT 1
- Binary Classification Expected Calibration Error 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.