Skip to content
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

Implement __getitem__ as "metric arithmetic" #132

Closed
victorjoos opened this issue Mar 25, 2021 · 2 comments · Fixed by #142
Closed

Implement __getitem__ as "metric arithmetic" #132

victorjoos opened this issue Mar 25, 2021 · 2 comments · Fixed by #142
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@victorjoos
Copy link
Contributor

🚀 Feature

Allow a user to define a new metric that takes an item out of an other metric.

Basically :

iou = IoU(num_classes=2, reduction="none")
fg_iou = iou[0]
bg_iou = iou[1]

Motivation

There are multiple metrics (like IoU and confusion matrix) that would benefit from the use of such a feature, and it is close to the mechanism of metric arithmetic.

Pitch

This would only need to define

class Metric:
    ...
    def __getitem__(self, idx):
        return CompositionalMetric(lambda x: x[idx], self, None)

Alternatives

The straightforward alternative is to use CompositionalMetric directly.

@victorjoos victorjoos added enhancement New feature or request help wanted Extra attention is needed labels Mar 25, 2021
@github-actions
Copy link

Hi! thanks for your contribution!, great first issue!

@SkafteNicki
Copy link
Member

SkafteNicki commented Mar 25, 2021

I think this great addition. @justusschock opinion?

@Borda Borda added this to the 0.3 milestone Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants