From 498ffa3b9a3ba5fc98a62e1eedc39f3926eb08b6 Mon Sep 17 00:00:00 2001 From: Edoardo Abati <29585319+EdAbati@users.noreply.github.com> Date: Sun, 26 May 2024 22:09:42 +0200 Subject: [PATCH 1/2] added test for paired_cosine_distances --- doc/modules/array_api.rst | 1 + doc/whats_new/v1.6.rst | 3 ++- sklearn/metrics/tests/test_common.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/modules/array_api.rst b/doc/modules/array_api.rst index 9b58cde56b09a..96d1155c0ccf8 100644 --- a/doc/modules/array_api.rst +++ b/doc/modules/array_api.rst @@ -105,6 +105,7 @@ Metrics - :func:`sklearn.metrics.mean_absolute_error` - :func:`sklearn.metrics.mean_tweedie_deviance` - :func:`sklearn.metrics.pairwise.cosine_similarity` +- :func:`sklearn.metrics.pairwise.paired_cosine_distances` - :func:`sklearn.metrics.r2_score` - :func:`sklearn.metrics.zero_one_loss` diff --git a/doc/whats_new/v1.6.rst b/doc/whats_new/v1.6.rst index 87814e102ad98..fd298da6895e5 100644 --- a/doc/whats_new/v1.6.rst +++ b/doc/whats_new/v1.6.rst @@ -37,6 +37,7 @@ See :ref:`array_api` for more details. :pr:`28106` by :user:`Thomas Li `; - :func:`sklearn.metrics.mean_absolute_error` :pr:`27736` by :user:`Edoardo Abati `; - :func:`sklearn.metrics.pairwise.cosine_similarity` :pr:`29014` by :user:`Edoardo Abati `. +- :func:`sklearn.metrics.pairwise.paired_cosine_distances` :pr:`` by :user:`Edoardo Abati `. **Classes:** @@ -80,7 +81,7 @@ Changelog - |Enhancement| Added a function :func:`base.is_clusterer` which determines whether a given estimator is of category clusterer. :pr:`28936` by :user:`Christian Veenhuis `. - + :mod:`sklearn.metrics` ...................... diff --git a/sklearn/metrics/tests/test_common.py b/sklearn/metrics/tests/test_common.py index 42f2a36445642..369316e267d64 100644 --- a/sklearn/metrics/tests/test_common.py +++ b/sklearn/metrics/tests/test_common.py @@ -51,7 +51,7 @@ zero_one_loss, ) from sklearn.metrics._base import _average_binary_score -from sklearn.metrics.pairwise import cosine_similarity +from sklearn.metrics.pairwise import cosine_similarity, paired_cosine_distances from sklearn.preprocessing import LabelBinarizer from sklearn.utils import shuffle from sklearn.utils._array_api import ( @@ -1938,6 +1938,7 @@ def check_array_api_metric_pairwise(metric, array_namespace, device, dtype_name) check_array_api_regression_metric, check_array_api_multioutput_regression_metric, ], + paired_cosine_distances: [check_array_api_metric_pairwise], } From fc1e53ed5c5fe86c43a56874fd2148e8a32adecf Mon Sep 17 00:00:00 2001 From: Edoardo Abati <29585319+EdAbati@users.noreply.github.com> Date: Sun, 26 May 2024 22:12:06 +0200 Subject: [PATCH 2/2] update pr number --- doc/whats_new/v1.6.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whats_new/v1.6.rst b/doc/whats_new/v1.6.rst index fd298da6895e5..1f75ab95f1307 100644 --- a/doc/whats_new/v1.6.rst +++ b/doc/whats_new/v1.6.rst @@ -37,7 +37,7 @@ See :ref:`array_api` for more details. :pr:`28106` by :user:`Thomas Li `; - :func:`sklearn.metrics.mean_absolute_error` :pr:`27736` by :user:`Edoardo Abati `; - :func:`sklearn.metrics.pairwise.cosine_similarity` :pr:`29014` by :user:`Edoardo Abati `. -- :func:`sklearn.metrics.pairwise.paired_cosine_distances` :pr:`` by :user:`Edoardo Abati `. +- :func:`sklearn.metrics.pairwise.paired_cosine_distances` :pr:`29112` by :user:`Edoardo Abati `. **Classes:**