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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metrics support mask #54
Comments
Looks nice! @YuxianMeng want to send it as a PR? |
My pleasure:) A little question is should this PR contain only masked precision metrics or also contain other metrics? |
I would say all, in fact it would be nice to have an abstract function/class that do this masking and the new metrics would be created just its application, so for example:
Does it make sense? @justusschock @SkafteNicki |
@YuxianMeng But with your implementation, you calculate it also for the values you set to -1 I think. What you instead need to do is |
@justusschock As for accuracy, actually only the non-negative classes are calculated. I thought about using |
I agree with @Borda that this should be an abstract function/class. The most simple, in my opinion, would be a class that the user can wrap their already existing metric with: |
@YuxianMeng mind send a PR and I guess @SkafteNicki or @justusschock could help/guide you throw 馃惏 |
I think I speak for both of us, saying that we'd for sure do that and really appreciate the PR :) |
Yes just ping us in the PR when you are ready, and we will assist you. |
Working on it, I will let you when I'm ready :) |
This issue has been closed. Does the mask metrics features has landed? Or nobody has worked on it yet? |
It was closed due to no activity, so it is still not a part of lightning. @hadim please feel free to pick it up and send a PR :] |
I have implemented a version of this in my own project, would anyone like to collaborate on making a PR for this? |
@davzaman please yes, would be a great addition :] |
I didn't implement it as a class wrapper, but I have a few ideas on how to do it. it might take me a little while as i have deadlines for other things but i will be working on this! |
Hello, perhaps I'm missing something but I'm not sure that there's a one-size-fits-all answer to this that can just be implemented as a wrapper. I may be breaking down the problem incorrectly. For metrics with a simple internal sum, just replacing values in the mask with 0 will suffice. For metrics that have an internal mean, the generic solution would be to sum over What are your thoughts? |
@davzaman I definitely see the problem. My original idea for this feature would be a simple wrapper that just internally does |
yeah I think each metric would need to have its own, there's not an insane amount of metrics but the overhead of including tests for all of them might be much. should we just let users figure out masking on their own? Is there something we can at least include to make the process easier? |
@davzaman @SkafteNicki how is it going here? |
Hi @Borda We ran into issues in trying to follow a one-size-fits-all approach to including masks for metrics, since internally the computations might be very different (which would change the logic required to properly compute a "masked" version of the metric). I wasn't sure how to proceed from here. From what I could tell, it would be best to have a masked version of each metric separately, even though it's more work. There's a chance there's a solution that I didn't see. |
I think this issue is related to #362. |
@davzaman @yassersouri could you pls open a draft PR so we have a more concrete discussion... |
@Borda I don't think I have the time to allocate to this at the moment but I am happy to help move things along. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Bumping this. I believe |
There was also some sort of attempt to support masked Tensors but I think it has died out https://github.com/pytorch/maskedtensor |
馃殌 Feature
Current metrics like Accuracy/Recall would be better to support mask.
Motivation
For example, when I deal with a Sequence Labeling Task and pad some sequence to max-length, I do not want to calculate metrics at the padding locations.
Pitch
I guess a simple manipulation would work for accuracy.(here is the original one)
Alternatives
Additional context
The text was updated successfully, but these errors were encountered: