From 2fcc2e29ac6005c244ac2939a155290ce416d2ad Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Tue, 4 Jul 2023 13:20:27 +0530 Subject: [PATCH 01/18] fix Allow 0= 1 and finite. For p = infinity, + Minkowski Distance requires p > 0 and finite. For p = infinity, use ChebyshevDistance. Note that for p=1, ManhattanDistance is more efficient, and for p=2, EuclideanDistance is more efficient. """ def __init__(self, p, w=None): - if p < 1: - raise ValueError("p must be greater than 1") + if p <= 0: + raise ValueError("p must be greater than 0") elif np.isinf(p): raise ValueError("MinkowskiDistance requires finite p. " "For p=inf, use ChebyshevDistance.") diff --git a/sklearn/metrics/tests/test_dist_metrics.py b/sklearn/metrics/tests/test_dist_metrics.py index 16aa5c569b161..edf61c1b32586 100644 --- a/sklearn/metrics/tests/test_dist_metrics.py +++ b/sklearn/metrics/tests/test_dist_metrics.py @@ -46,14 +46,14 @@ def dist_func(x1, x2, p): METRICS_DEFAULT_PARAMS = [ ("euclidean", {}), ("cityblock", {}), - ("minkowski", dict(p=(1, 1.5, 2, 3))), + ("minkowski", dict(p=(0.5, 1, 1.5, 2, 3))), ("chebyshev", {}), ("seuclidean", dict(V=(rng.random_sample(d),))), ("mahalanobis", dict(VI=(VI,))), ("hamming", {}), ("canberra", {}), ("braycurtis", {}), - ("minkowski", dict(p=(1, 1.5, 3), w=(rng.random_sample(d),))), + ("minkowski", dict(p=(0.5, 1, 1.5, 3), w=(rng.random_sample(d),))), ] @@ -397,3 +397,9 @@ def test_get_metric_bad_dtype(): msg = r"Unexpected dtype .* provided. Please select a dtype from" with pytest.raises(ValueError, match=msg): DistanceMetric.get_metric("manhattan", dtype) + + +def test_minkowski_metric_validate_bad_p_parameter(): + msg = "p must be greater than 0" + with pytest.raises(ValueError, match=msg): + DistanceMetric.get_metric("minkowski", p=0) From fa69fcf437344ed945fc0e17584b1832c65986eb Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Wed, 5 Jul 2023 09:51:31 +0530 Subject: [PATCH 02/18] added change log entry --- doc/whats_new/v1.4.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/whats_new/v1.4.rst b/doc/whats_new/v1.4.rst index 6a5660ee27b2e..194968fb6cc94 100644 --- a/doc/whats_new/v1.4.rst +++ b/doc/whats_new/v1.4.rst @@ -71,7 +71,6 @@ TODO: update at the time of the release. :pr:`13649` by :user:`Samuel Ronsin `, initiated by :user:`Patrick O'Reilly `. - :mod:`sklearn.tree` ................... @@ -100,3 +99,11 @@ TODO: update at the time of the release. - |Fix| :func:`feature_selection.mutual_info_regression` now correctly computes the result when `X` is of integer dtype. :pr:`26748` by :user:`Yao Xiao `. + + +:mod:`sklearn.metrics` +....................... + +- |Fix| The `"minkowski"` metric of :class:`metrics.DistanceMetric` now correctly allows + parameter `p` to accept values greater than 0 and less than 1. + :pr:`26760` by :user:`Shreesha Kumar Bhat `. From c868d4405b06d0059047d636aaf37c488c7044ed Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Thu, 6 Jul 2023 18:42:10 +0530 Subject: [PATCH 03/18] added scipy version check for cdist --- sklearn/metrics/tests/test_dist_metrics.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sklearn/metrics/tests/test_dist_metrics.py b/sklearn/metrics/tests/test_dist_metrics.py index edf61c1b32586..777a474b3019f 100644 --- a/sklearn/metrics/tests/test_dist_metrics.py +++ b/sklearn/metrics/tests/test_dist_metrics.py @@ -15,6 +15,7 @@ ) from sklearn.utils import check_random_state from sklearn.utils._testing import assert_allclose, create_memmap_backed_data +from sklearn.utils.fixes import parse_version, sp_version def dist_func(x1, x2, p): @@ -76,6 +77,17 @@ def test_cdist(metric_param_grid, X, Y): # with scipy rtol_dict = {"rtol": 1e-6} + # TODO: Remove when scipy minimum version is upgraded to 1.7.0 + # scipy supports 0 Date: Thu, 6 Jul 2023 21:57:47 +0530 Subject: [PATCH 04/18] update scipy check in test_dist_metrics --- sklearn/metrics/tests/test_dist_metrics.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/sklearn/metrics/tests/test_dist_metrics.py b/sklearn/metrics/tests/test_dist_metrics.py index 777a474b3019f..e13cafde97e5a 100644 --- a/sklearn/metrics/tests/test_dist_metrics.py +++ b/sklearn/metrics/tests/test_dist_metrics.py @@ -77,15 +77,14 @@ def test_cdist(metric_param_grid, X, Y): # with scipy rtol_dict = {"rtol": 1e-6} - # TODO: Remove when scipy minimum version is upgraded to 1.7.0 - # scipy supports 0= 1.7.0 + # scipy supports 0= 1.7.0 if metric == "minkowski": # default value of p for Minkowski is 2 p = float(kwargs.get("p", 2)) + print("p", p) if sp_version < parse_version("1.7.0") and p < 1: - msg = "p must be at least 1" - with pytest.raises(ValueError, match=msg): - D_scipy_cdist = cdist(X, Y, metric, **kwargs) + pytest.skip("scipy does not support 0= 1.7.0 + # scipy supports 0= 1.7.0 if metric == "minkowski": # default value of p for Minkowski is 2 p = float(kwargs.get("p", 2)) if sp_version < parse_version("1.7.0") and p < 1: - msg = "p must be at least 1" - with pytest.raises(ValueError, match=msg): - D_scipy_pdist = cdist(X, X, metric, **kwargs) + pytest.skip("scipy does not support 0 Date: Thu, 6 Jul 2023 23:10:13 +0530 Subject: [PATCH 05/18] removed unnecsary return in test --- sklearn/metrics/tests/test_dist_metrics.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/sklearn/metrics/tests/test_dist_metrics.py b/sklearn/metrics/tests/test_dist_metrics.py index e13cafde97e5a..f263606d41039 100644 --- a/sklearn/metrics/tests/test_dist_metrics.py +++ b/sklearn/metrics/tests/test_dist_metrics.py @@ -85,7 +85,6 @@ def test_cdist(metric_param_grid, X, Y): print("p", p) if sp_version < parse_version("1.7.0") and p < 1: pytest.skip("scipy does not support 0 Date: Fri, 7 Jul 2023 10:36:20 +0530 Subject: [PATCH 06/18] updated whats_new 1.4 --- doc/whats_new/v1.4.rst | 6 ++++-- sklearn/metrics/_dist_metrics.pyx.tp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/whats_new/v1.4.rst b/doc/whats_new/v1.4.rst index ad9201f62bcfd..9db02fe6eb068 100644 --- a/doc/whats_new/v1.4.rst +++ b/doc/whats_new/v1.4.rst @@ -81,8 +81,10 @@ Changelog :mod:`sklearn.metrics` ....................... -- |Fix| The `"minkowski"` metric of :class:`metrics.DistanceMetric` now correctly allows - parameter `p` to accept values greater than 0 and less than 1. +- |ENH| The `"minkowski"` metric of :class:`metrics.DistanceMetric` now allows + parameter `p` to accept values greater than 0 and less than 1. Although `"Minkowski"`` + metric is not a true metric for `p<1`, objective is to allow `0`. :mod:`sklearn.tree` diff --git a/sklearn/metrics/_dist_metrics.pyx.tp b/sklearn/metrics/_dist_metrics.pyx.tp index af2e3e79f1330..b7ff2530763db 100644 --- a/sklearn/metrics/_dist_metrics.pyx.tp +++ b/sklearn/metrics/_dist_metrics.pyx.tp @@ -1276,7 +1276,7 @@ cdef class MinkowskiDistance{{name_suffix}}(DistanceMetric{{name_suffix}}): w : (N,) array-like (optional) The weight vector. - Minkowski Distance requires p > 0 and finite. For p = infinity, + Minkowski Distance requires p >= 1 and finite. For p = infinity, use ChebyshevDistance. Note that for p=1, ManhattanDistance is more efficient, and for p=2, EuclideanDistance is more efficient. From e9b5039724e56ce8f8cf560fda603e388c031a35 Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Sat, 8 Jul 2023 08:30:32 +0530 Subject: [PATCH 07/18] fixed suggestions from Micky774 --- sklearn/metrics/_dist_metrics.pyx.tp | 8 ++++++++ sklearn/metrics/tests/test_dist_metrics.py | 8 ++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sklearn/metrics/_dist_metrics.pyx.tp b/sklearn/metrics/_dist_metrics.pyx.tp index b7ff2530763db..717ddb9481c7b 100644 --- a/sklearn/metrics/_dist_metrics.pyx.tp +++ b/sklearn/metrics/_dist_metrics.pyx.tp @@ -1273,6 +1273,11 @@ cdef class MinkowskiDistance{{name_suffix}}(DistanceMetric{{name_suffix}}): ---------- p : int The order of the p-norm of the difference (see above). + + .. versionchanged:: 1.4.0 + Minkowski distance allows `p` to be `0= 1.7.0 # scipy supports 0= 1.7.0 if metric == "minkowski": - # default value of p for Minkowski is 2 - p = float(kwargs.get("p", 2)) - print("p", p) + p = kwargs["p"] if sp_version < parse_version("1.7.0") and p < 1: pytest.skip("scipy does not support 0= 1.7.0 # scipy supports 0= 1.7.0 if metric == "minkowski": - # default value of p for Minkowski is 2 - p = float(kwargs.get("p", 2)) + p = kwargs["p"] if sp_version < parse_version("1.7.0") and p < 1: pytest.skip("scipy does not support 0 Date: Sat, 8 Jul 2023 20:58:21 +0530 Subject: [PATCH 08/18] updated doc of Minkowski Distance --- sklearn/metrics/_dist_metrics.pyx.tp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sklearn/metrics/_dist_metrics.pyx.tp b/sklearn/metrics/_dist_metrics.pyx.tp index 717ddb9481c7b..3d2ef9a2a6d76 100644 --- a/sklearn/metrics/_dist_metrics.pyx.tp +++ b/sklearn/metrics/_dist_metrics.pyx.tp @@ -70,7 +70,10 @@ cdef class DistanceMetric: """Get the given distance metric from the string identifier. See the docstring of DistanceMetric for a list of available metrics. - + $p\in(0, 1)$ + p\in(0, 1) + p in (0,1) + :math:`p \in (0,1)` Parameters ---------- metric : str or class name @@ -79,6 +82,7 @@ cdef class DistanceMetric: The dtype of the data on which the metric will be applied **kwargs additional arguments will be passed to the requested metric + """ if dtype == np.float32: specialized_class = DistanceMetric32 @@ -1281,12 +1285,12 @@ cdef class MinkowskiDistance{{name_suffix}}(DistanceMetric{{name_suffix}}): w : (N,) array-like (optional) The weight vector. - Minkowski Distance requires p >= 1 and finite. For p = infinity, - use ChebyshevDistance. + Minkowski Distance requires p >= 1 and finite. + When :math:`p \in (0,1)`, it isn't a true metric but is permissible when + the triangular inequality isn't necessary. + For p = infinity, use ChebyshevDistance. Note that for p=1, ManhattanDistance is more efficient, and for p=2, EuclideanDistance is more efficient. - For `p<1`, `"Minkowski"` isn't a true metric but is permissible when - the triangular inequality isn't necessary. """ def __init__(self, p, w=None): From ab73914248a5334cc49e2312e16e2825acce591d Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Sat, 8 Jul 2023 21:22:41 +0530 Subject: [PATCH 09/18] update changelog --- doc/whats_new/v1.4.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/whats_new/v1.4.rst b/doc/whats_new/v1.4.rst index 9db02fe6eb068..8a22238918d79 100644 --- a/doc/whats_new/v1.4.rst +++ b/doc/whats_new/v1.4.rst @@ -81,10 +81,8 @@ Changelog :mod:`sklearn.metrics` ....................... -- |ENH| The `"minkowski"` metric of :class:`metrics.DistanceMetric` now allows - parameter `p` to accept values greater than 0 and less than 1. Although `"Minkowski"`` - metric is not a true metric for `p<1`, objective is to allow `0`. :mod:`sklearn.tree` From 72c78795a8b3ae79a2de2a9ecd4b2258daff1edf Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Sat, 8 Jul 2023 22:01:33 +0530 Subject: [PATCH 10/18] remved mistakenly added --- sklearn/metrics/_dist_metrics.pyx.tp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sklearn/metrics/_dist_metrics.pyx.tp b/sklearn/metrics/_dist_metrics.pyx.tp index 3d2ef9a2a6d76..80aed313b35d9 100644 --- a/sklearn/metrics/_dist_metrics.pyx.tp +++ b/sklearn/metrics/_dist_metrics.pyx.tp @@ -70,10 +70,7 @@ cdef class DistanceMetric: """Get the given distance metric from the string identifier. See the docstring of DistanceMetric for a list of available metrics. - $p\in(0, 1)$ - p\in(0, 1) - p in (0,1) - :math:`p \in (0,1)` + Parameters ---------- metric : str or class name From 4c3fc42f28e1dfbbdc15724bfeabba8fc9dacb10 Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Sat, 8 Jul 2023 22:06:53 +0530 Subject: [PATCH 11/18] remved mistakenly added --- sklearn/metrics/_dist_metrics.pyx.tp | 1 - 1 file changed, 1 deletion(-) diff --git a/sklearn/metrics/_dist_metrics.pyx.tp b/sklearn/metrics/_dist_metrics.pyx.tp index 80aed313b35d9..e81fe369e2fd5 100644 --- a/sklearn/metrics/_dist_metrics.pyx.tp +++ b/sklearn/metrics/_dist_metrics.pyx.tp @@ -79,7 +79,6 @@ cdef class DistanceMetric: The dtype of the data on which the metric will be applied **kwargs additional arguments will be passed to the requested metric - """ if dtype == np.float32: specialized_class = DistanceMetric32 From a29267752a81aca773cefca5a999ff13fa5c92bd Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Wed, 12 Jul 2023 21:41:21 +0530 Subject: [PATCH 12/18] update whatsnew 1.4 --- doc/whats_new/v1.4.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/whats_new/v1.4.rst b/doc/whats_new/v1.4.rst index 8a22238918d79..dcd320f6e80e9 100644 --- a/doc/whats_new/v1.4.rst +++ b/doc/whats_new/v1.4.rst @@ -78,12 +78,11 @@ Changelog - |Fix| :func:`feature_selection.mutual_info_regression` now correctly computes the result when `X` is of integer dtype. :pr:`26748` by :user:`Yao Xiao `. -:mod:`sklearn.metrics` +:mod:`sklearn.neighbors` ....................... -- |Enhancement| The `"Minkowski"` metric of :class:`metrics.DistanceMetric` now accepts - parameter `p` values in the open interval (0,1). - :pr:`26760` by :user:`Shreesha Kumar Bhat `. +- |Fix| :class:`neighbors.NearestNeighbors` now works with `p < 1` regardless of the + `dtype` of `X`. :pr:`26760` by :user:`Shreesha Kumar Bhat `. :mod:`sklearn.tree` ................... From a0668031d0b6176aab6b3ccdda9892be1b511f11 Mon Sep 17 00:00:00 2001 From: Shreesha Kumar Bhat Date: Wed, 12 Jul 2023 21:44:02 +0530 Subject: [PATCH 13/18] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com> --- sklearn/metrics/_dist_metrics.pyx.tp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sklearn/metrics/_dist_metrics.pyx.tp b/sklearn/metrics/_dist_metrics.pyx.tp index e81fe369e2fd5..43497c9c50cee 100644 --- a/sklearn/metrics/_dist_metrics.pyx.tp +++ b/sklearn/metrics/_dist_metrics.pyx.tp @@ -1271,7 +1271,7 @@ cdef class MinkowskiDistance{{name_suffix}}(DistanceMetric{{name_suffix}}): Parameters ---------- - p : int + p : float The order of the p-norm of the difference (see above). .. versionchanged:: 1.4.0 @@ -1281,7 +1281,7 @@ cdef class MinkowskiDistance{{name_suffix}}(DistanceMetric{{name_suffix}}): w : (N,) array-like (optional) The weight vector. - Minkowski Distance requires p >= 1 and finite. + Minkowski Distance requires p > 0 and finite. When :math:`p \in (0,1)`, it isn't a true metric but is permissible when the triangular inequality isn't necessary. For p = infinity, use ChebyshevDistance. From 08f095c1c242897df9925c8693a70c0bd3389089 Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Wed, 12 Jul 2023 22:33:34 +0530 Subject: [PATCH 14/18] update whatsnew 1.4 --- doc/whats_new/v1.4.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/whats_new/v1.4.rst b/doc/whats_new/v1.4.rst index dcd320f6e80e9..fa2ee7b546cae 100644 --- a/doc/whats_new/v1.4.rst +++ b/doc/whats_new/v1.4.rst @@ -81,8 +81,8 @@ Changelog :mod:`sklearn.neighbors` ....................... -- |Fix| :class:`neighbors.NearestNeighbors` now works with `p < 1` regardless of the - `dtype` of `X`. :pr:`26760` by :user:`Shreesha Kumar Bhat `. +- |Fix| :class:`neighbors.NearestNeighbors` now correctly works with `p < 1` regardless + of the `dtype` of `X`. :pr:`26760` by :user:`Shreesha Kumar Bhat `. :mod:`sklearn.tree` ................... From 5eb17532e444c36353383ce5d2c357d55ed23f39 Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Thu, 13 Jul 2023 07:32:43 +0530 Subject: [PATCH 15/18] fix title underline too short error --- doc/whats_new/v1.4.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats_new/v1.4.rst b/doc/whats_new/v1.4.rst index fa2ee7b546cae..5fe6ee08d0cde 100644 --- a/doc/whats_new/v1.4.rst +++ b/doc/whats_new/v1.4.rst @@ -79,7 +79,7 @@ Changelog result when `X` is of integer dtype. :pr:`26748` by :user:`Yao Xiao `. :mod:`sklearn.neighbors` -....................... +........................ - |Fix| :class:`neighbors.NearestNeighbors` now correctly works with `p < 1` regardless of the `dtype` of `X`. :pr:`26760` by :user:`Shreesha Kumar Bhat `. From 7d9edbc7dad760340dd0e408e88017254840aa0f Mon Sep 17 00:00:00 2001 From: shreesha3112 Date: Fri, 14 Jul 2023 15:41:43 +0530 Subject: [PATCH 16/18] added non regresssion test for p<1 in test_neighbors --- doc/whats_new/v1.4.rst | 5 +++-- sklearn/neighbors/tests/test_neighbors.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/doc/whats_new/v1.4.rst b/doc/whats_new/v1.4.rst index 5fe6ee08d0cde..e3ab704dabb7d 100644 --- a/doc/whats_new/v1.4.rst +++ b/doc/whats_new/v1.4.rst @@ -81,8 +81,9 @@ Changelog :mod:`sklearn.neighbors` ........................ -- |Fix| :class:`neighbors.NearestNeighbors` now correctly works with `p < 1` regardless - of the `dtype` of `X`. :pr:`26760` by :user:`Shreesha Kumar Bhat `. +- |Fix| :class:`neighbors.NearestNeighbors` now correctly works with `p < 1` when + `algorithm` selected is `"auto"` or `"brute"` regardless of the `dtype` of `X`. + :pr:`26760` by :user:`Shreesha Kumar Bhat `. :mod:`sklearn.tree` ................... diff --git a/sklearn/neighbors/tests/test_neighbors.py b/sklearn/neighbors/tests/test_neighbors.py index 405ac3a6d0847..d24fc618d184c 100644 --- a/sklearn/neighbors/tests/test_neighbors.py +++ b/sklearn/neighbors/tests/test_neighbors.py @@ -2207,3 +2207,22 @@ def test_predict_dataframe(): knn = neighbors.KNeighborsClassifier(n_neighbors=2).fit(X, y) knn.predict(X) + + +def test_nearest_neighbours_works_with_p_less_than_1(): + """Check that NearestNeighbors works with :math:`p \\in (0,1)` when `algorithm` + is `"auto"` or `"brute"` regardless of the dtype of X. + + Non-regression test for issue #26548 + """ + X = np.array([[1.0, 0.0], [0.0, 0.0], [0.0, 1.0]]) + neigh = neighbors.NearestNeighbors( + n_neighbors=3, algorithm="brute", metric_params={"p": 0.5} + ) + neigh.fit(X) + + y = neigh.radius_neighbors(X[0].reshape(1, -1), radius=4, return_distance=False) + assert_allclose(y[0], [0, 1, 2]) + + y = neigh.kneighbors(X[0].reshape(1, -1), return_distance=False) + assert_allclose(y[0], [0, 1, 2]) From 3f79c3bab13f2d37d4d903346b498559e2d39355 Mon Sep 17 00:00:00 2001 From: Shreesha Kumar Bhat Date: Thu, 20 Jul 2023 22:19:48 +0530 Subject: [PATCH 17/18] Update doc/whats_new/v1.4.rst Co-authored-by: Meekail Zain <34613774+Micky774@users.noreply.github.com> --- doc/whats_new/v1.4.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats_new/v1.4.rst b/doc/whats_new/v1.4.rst index 2a559346796ca..f00b20223aa62 100644 --- a/doc/whats_new/v1.4.rst +++ b/doc/whats_new/v1.4.rst @@ -113,7 +113,7 @@ Changelog :mod:`sklearn.neighbors` ........................ -- |Fix| :class:`neighbors.NearestNeighbors` now correctly works with `p < 1` when +- |Fix| :class:`neighbors.NearestNeighbors` now correctly works with `0 < p < 1` when `algorithm` selected is `"auto"` or `"brute"` regardless of the `dtype` of `X`. :pr:`26760` by :user:`Shreesha Kumar Bhat `. From 67500287290659983a9625795c95da1aee774a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20du=20Boisberranger?= <34657725+jeremiedbb@users.noreply.github.com> Date: Wed, 26 Jul 2023 17:27:09 +0200 Subject: [PATCH 18/18] Update v1.4.rst --- doc/whats_new/v1.4.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/whats_new/v1.4.rst b/doc/whats_new/v1.4.rst index f00b20223aa62..4994432df8034 100644 --- a/doc/whats_new/v1.4.rst +++ b/doc/whats_new/v1.4.rst @@ -113,8 +113,8 @@ Changelog :mod:`sklearn.neighbors` ........................ -- |Fix| :class:`neighbors.NearestNeighbors` now correctly works with `0 < p < 1` when - `algorithm` selected is `"auto"` or `"brute"` regardless of the `dtype` of `X`. +- |Fix| Neighbors based estimators now correctly work when `metric="minkowski"` and the + metric parameter `p` is in the range `0 < p < 1`, regardless of the `dtype` of `X`. :pr:`26760` by :user:`Shreesha Kumar Bhat `. :mod:`sklearn.tree`