-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ENH Allow 0<p<1 for Minkowski metric #26760
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
ENH Allow 0<p<1 for Minkowski metric #26760
Conversation
CI failing since Scipy issue for reference: scipy/scipy#15055 |
Rather than bumping the minimum dependency, we can instead modify the tests based on what the installed version of
|
…ce_when_p_less_than_1
…ce_when_p_less_than_1
Side note: As per scipy release notes, |
We should update the documentation of |
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.
Thanks for the PR @Shreesha3112. Just a few comments, looks good otherwise
doc/whats_new/v1.4.rst
Outdated
- |Enhancement| The `"Minkowski"` metric of :class:`metrics.DistanceMetric` now accepts | ||
parameter `p` values in the open interval (0,1). |
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.
I'd rather have a higher level message more related to the original issue, like say that NearestNeighbors
now works with p < 1 regardless of the dtype of X, and mark this entry as a |Fix|
…ce_when_p_less_than_1
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
One last thing that I forgot to ask yesterday: please add a non-regression test for this; something like the reproducer given in the linked issue #26548 (comment). |
Added non-regression test |
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.
This also impacts other estimators -- really any that directly use MinkowskiDistance{32, 64}
-- should we document this change for them as well in this PR? What do you think @jeremiedbb?
Otherwise looks good, thanks!
Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com>
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.
LGTM. Thanks @Shreesha3112
I updated the message to be more generic about neighbors based estimators |
…learn#26760) Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com>
…learn#26760) Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com>
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com>
…learn#26760) Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com>
Reference Issues/PRs
Fixes #26548
What does this implement/fix? Explain your changes.
Currently
MinkowskiDistance
metricraises ValueError("p must be greater than 1")
ifp<1
. This PR allows0<p<1
.Any other comments?