-
Notifications
You must be signed in to change notification settings - Fork 423
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
Support for MetricTracker of MultioutputWrapper #1409
Comments
Hi! thanks for your contribution!, great first issue! |
After looking at the code and starting to implement a solution, I completely updated the issue's description to make it much more clear. |
* Add config corresponding to a `MetricTracker` of `MultioutputWrapper` of `MeanSquaredError` * Add config corresponding to a `MetricTracker` of `MetricCollection` of (`MultioutputWrapper` of `MeanSquaredError` and `MultioutpuWrapper` of `MeanAbsoluteError` * Change test checks so that they work when `tracker.compute()` returns tensors of dimension > 0 * Change checks on `MetricTracker.best_metric` to work when this method returns lists or dicts of lists
* When this parameter is set to True, the output of the `compute_method` is stacked as a higher dimensional Tensor rather than a list
* Add support to `MultioutputWrapper` * Add support to `MetricCollection` of `MultioutputWrapper`
* Add entry about Lightning-AI#1409 in the `Added` section
* When this parameter is set to True, the output of the `compute_method` is stacked as a higher dimensional Tensor rather than a list
* Add support to `MultioutputWrapper` * Add support to `MetricCollection` of `MultioutputWrapper`
* Add entry about Lightning-AI#1409 in the `Added` section
* Add test configuration for test_tracker with a `MetricTracker` of `MultioutputWrapper` * Change the test to support the case where the values returned by `MetricTracker` are lists
* Add support for `MultioutputMetric` as base metric in `compute_all` * Add support for `MultioutputMetric` as base metric in `best_metric`
* Add test configuration for test_tracker with a `MetricTracker` of `MetricCollection` of `MultioutputWrapper` * Change the test to support the case where the values returned by `MetricTracker` are dicts of lists
* Add support for `MetricCollection` of `MultioutputMetric` as base metric in `compute_all` * Add support for `MetricCollection` of `MultioutputMetric` as base metric in `best_metric`
* Add entry about Lightning-AI#1409 in the `Added` section
Hi @ValerianRey, |
I added some new tests and the solution that makes them work when using a MetricTracker of MultioutputWrapper or a MetricTracker of MetricCollection of MultioutputWrapper. Everything works, but I don't like it this way. The MetricTracker class becomes too complex for what it does. The return type of best_metric becomes even more complex for example: 12 possible return types. I think this class needs some deep changes before we invest too much development into it (some changes that would not make it backward-compatible). |
🚀 Feature
Currently,
MetricTracker
works in the following cases:Metric
, and itscompute
method returns a singleTensor
MetricCollection
and itscompute
method returns adict[str, Tensor]
I would like to add support for two other cases which I came across in my projects:
MultioutputWrapper
. Note thatMultioutputWrapper
is a subclass ofMetric
, but it is not supported byMetricTracker
because itscompute
method returns aList[Tensor]
rather than a singleTensor
.MetricCollection
ofMultioutputWrapper
. In thise case thecompute
method returns adict[str, List[Tensor]]
.Motivation
MultioutputWrapper
quite a lot for multi-regression problems. If I want to track its evolution over the epochs, I need to use aMetricTracker
ofMultioutputWrapper
.MetricTracker
ofMetricCollection
ofMultioutputWrapper
.Pitch
After looking at the code, here is my proposed solution:
MetricTracker
'scompute_all
method to support both of the new cases mentioned above.MetricTracker
sbest_metric
method to support both of the new cases mentioned above.Alternatives
Add a boolean parameter to
MetricTracker
to make it return aTensor
of higher dimension rather than aList[Tensor]
.I don't really know which solution is best so I'll try to implement both in 2 different branches.
The text was updated successfully, but these errors were encountered: