-
Notifications
You must be signed in to change notification settings - Fork 413
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
Added MinkowskiDistance
support
#1362
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is already looking good :]
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1362 +/- ##
========================================
- Coverage 86% 39% -48%
========================================
Files 216 219 +3
Lines 11359 11473 +114
========================================
- Hits 9802 4449 -5353
- Misses 1557 7024 +5467 |
Co-authored-by: Nicki Skafte Detlefsen <[email protected]>
for more information, see https://pre-commit.ci
One question before a deeper review: As Minkowsi Distance is a generalization of Euclidean and Manhattan distance, shouldn't this metric for consistency be included rather in pairwise metrics as the other two? |
good question, I would move it to pairwise 🐰 |
In that case, should I add the pairwise metric while keeping the functional and class metrics? |
@Borda @clueless-skywatcher Actually, I don't know why we don't have module metrics for pairwise metrics. @Borda, is there any reason for this? If not, would it make sense to add class metrics in a separate PR? |
@stancld @clueless-skywatcher I think it is a bit tricky as most of the regression metrics could be seen also as pairwise metrics, right? |
@stancld @Borda the core reason that I did not implement the pairwise metrics as modular long time ago, is that the size of the output differ depending on the size of the input: X = torch.randn(N, d)
Y = torch.randn(M, d)
out = pairwise(X, y) # shape [N,M] if That said, we could settle on the modular version always doing some kind of reduction: X = torch.randn(N, d)
Y = torch.randn(M, d)
out = Pairwise(reduction='sum')(X, y) # shape [1,] What do you think? |
I am fine with both options 🦦 |
Co-authored-by: Luca Di Liello <[email protected]>
What does this PR do?
Fixes #1345
Adds the Minkowski Distance metric as a regression metric. Adds both functional and object-oriented versions of the metric.
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Absolutely! As a first-time contributor I got to learn more things and feeling proud that I am beginning to be a part of a huge open-source community.