Comments (11)
Hello @SkafteNicki I like the idea of your implementation and I think it could add as well an optional argument to the clone
method.
I am thinking something like ...
...
def clone(self, prefix = None):
cloned = super().clone()
if prefix is not None:
cloned.prefix = prefix
return cloned
...
Since it would make it a lot easier to make clones of large collections (train and test metrics for instance ...)
let me know when you feel would be a good time to work on it (although i feel like you got it covered, thanks a lot)
from torchmetrics.
@jspaezp please checkout the PR I have opened #70 to see if anything is missing :]
from torchmetrics.
Fix the documentation. Does MetricCollection
have a mechanism to set a prefix? If it doesn't, then the argument should be added there
from torchmetrics.
@carmocca are you in favor of adding the argument to log_dict
or fix the documentation?
from torchmetrics.
@carmocca I agree this would be a nice addition and the implementation seems easy ...
-def __init__(self, metrics: Union[List[Metric], Tuple[Metric], Dict[str, Metric]]):
+def __init__(self, metrics: Union[List[Metric], Tuple[Metric], Dict[str, Metric]], prefix: Union[Literal[None],str]=None):
super().__init__()
if isinstance(metrics, dict):
+ prefix = prefix if prefix is not None else ""
# Check all values are metrics
for name, metric in metrics.items():
if not isinstance(metric, Metric):
raise ValueError(
f"Value {metric} belonging to key {name}"
" is not an instance of `pl.metrics.Metric`"
)
- self[name] = metric
+ self[prefix + name] = metric
possibly add a warning as well if a list (and not a dict) is passed so you know that it will get ignored.
let me know if you want the PR. (I could also update the docs)
Kindest wishes,
Sebastian
from torchmetrics.
@jspaezp your solution looks very similar to the one I had in mind:
Lightning-AI/pytorch-lightning@master...SkafteNicki:fix_prefix_arg
Feel free to submit a PR but please wait a couple of days for an update that will come to the metrics package (cannot disclose exactly what right now) :]
from torchmetrics.
I'm just updating to the latest version of pytorch lightning and I ran into this issue also. Do we have an ETA for when it will be released?
from torchmetrics.
Hi! thanks for your contribution!, great first issue!
from torchmetrics.
@SkafteNicki looks great! Amazing work!
@uwaisiqbal (just mentioning you so you know it is getting merged)
from torchmetrics.
Awesome thanks for the update and for the amazing work!
from torchmetrics.
When is the update with the prefix
arg going to be released? Also, the documentation for the MetricCollections
is out of date where it mentions the prefix
arg can be used when cloning the MetricCollection
https://torchmetrics.readthedocs.io/en/latest/pages/overview.html#metriccollection
from torchmetrics.
Related Issues (20)
- 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
- `intersection_over_union` error HOT 2
- Clarify that nan is supported in zero_division HOT 4
- Add `_filter_kwargs` in `ClasswiseWrapper` metric wrapper HOT 3
- MetricTracker use higher_is_better as default for maximize HOT 2
- Unpredictable class order when `panoptic_quality(..., return_per_class=True)`
- torchmetrics Accuracy HOT 8
- BootStrapper.reset() does not reset properly
- segmentation.MeanIoU is wrong HOT 3
- DataLoader worker is killed in Docker HOT 4
- MeanAveragePrecision - bug in `max_detection_thresholds` HOT 3
- Documentation of ERGAS HOT 1
- Support for DLM (AIM) metric HOT 1
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.