Repository navigation
MNT Deprecate metrics.pairwise.paired_*_distances and paired_distances public functions - #27129
Shreesha3112 wants to merge 13 commits into
Conversation
|
I've noticed that the changes to |
|
Maybe we could put the code in private functions (with a The |
…distance_public_funcs
…distance_public_funcs
|
I resolved the conflicts with |
glemaitre
left a comment
There was a problem hiding this comment.
I am fine with the deprecation. I only commented to add some info that we use when we grep the files seeking for deprecated function/variables.
| "sklearn.metrics.pairwise.linear_kernel", | ||
| "sklearn.metrics.pairwise.manhattan_distances", | ||
| "sklearn.metrics.pairwise.nan_euclidean_distances", | ||
| "sklearn.metrics.pairwise.paired_cosine_distances", |
There was a problem hiding this comment.
I would still test them but add a comment above to remove them.
There was a problem hiding this comment.
I think this still needs to be reverted.
glemaitre
left a comment
There was a problem hiding this comment.
I am fine with the deprecation. I only commented to add some info that we use when we grep the files seeking for deprecated function/variables. Thanks @Shreesha3112
glemaitre
left a comment
There was a problem hiding this comment.
I am fine with the deprecation. I only commented to add some info that we use when we grep the files seeking for deprecated function/variables. Thanks @Shreesha3112
Co-authored-by: Guillaume Lemaitre <[email protected]>
amueller
left a comment
There was a problem hiding this comment.
Looks good but I'd add a note to the deprecation message that tells users what function to use instead (pairwise_distances I assume).
thomasjpfan
left a comment
There was a problem hiding this comment.
Looks good but I'd add a note to the deprecation message that tells users what function to use instead (pairwise_distances I assume).
@amueller If the paired_*_distances are removed, there is no direct replacement.
| metrics.pairwise.paired_euclidean_distances | ||
| metrics.pairwise.paired_manhattan_distances | ||
| metrics.pairwise.paired_cosine_distances | ||
| metrics.pairwise.paired_distances |
There was a problem hiding this comment.
Can these be moved to
scikit-learn/doc/modules/classes.rst
Lines 1903 to 1904 in 93f6ce9
| :func:`~metrics.pairwise.paired_euclidean_distances`, | ||
| :func:`~metrics.pairwise.paired_manhattan_distances` and | ||
| :func:`~metrics.pairwise.paired_cosine_distances` are now deprecated and | ||
| will be removed in 1.6. |
There was a problem hiding this comment.
Since 1.4 is released, this changelog entry needs to be moved to v1.5.rst and:
| will be removed in 1.6. | |
| will be removed in 1.7. |
| return S | ||
|
|
||
|
|
||
| # TODO(1.6): Remove in 1.6 |
There was a problem hiding this comment.
| # TODO(1.6): Remove in 1.6 | |
| # TODO(1.7): Remove in 1.7 |
| # TODO(1.6): Remove in 1.6 | ||
| @deprecated( | ||
| "The public function `sklearn.pairwise.paired_euclidean_distances` has been " | ||
| "deprecated in 1.4 and will be removed in 1.6." |
There was a problem hiding this comment.
| "deprecated in 1.4 and will be removed in 1.6." | |
| "deprecated in 1.5 and will be removed in 1.7." |
| return row_norms(X - Y) | ||
|
|
||
|
|
||
| # TODO(1.6): Remove in 1.6 |
There was a problem hiding this comment.
| # TODO(1.6): Remove in 1.6 | |
| # TODO(1.7): Remove in 1.7 |
| # TODO*1.6: Remove in 1.6 | ||
| @deprecated( | ||
| "The public function `sklearn.pairwise.paired_cosine_distances` has been " | ||
| "deprecated in 1.4 and will be removed in 1.6." |
There was a problem hiding this comment.
| "deprecated in 1.4 and will be removed in 1.6." | |
| "deprecated in 1.5 and will be removed in 1.7." |
| return np.abs(diff).sum(axis=-1) | ||
|
|
||
|
|
||
| # TODO*1.6: Remove in 1.6 |
There was a problem hiding this comment.
| # TODO*1.6: Remove in 1.6 | |
| # TODO(1.7): Remove in 1.7 |
| } | ||
|
|
||
|
|
||
| # TODO(1.6): Remove in 1.6 |
There was a problem hiding this comment.
| # TODO(1.6): Remove in 1.6 | |
| # TODO(1.7): Remove in 1.7 |
| # TODO(1.6): Remove in 1.6 | ||
| @deprecated( | ||
| "The public function `sklearn.pairwise.paired_distances` has been " | ||
| "deprecated in 1.4 and will be removed in 1.6." |
There was a problem hiding this comment.
| "deprecated in 1.4 and will be removed in 1.6." | |
| "deprecated in 1.5 and will be removed in 1.7." |
| "sklearn.metrics.pairwise.linear_kernel", | ||
| "sklearn.metrics.pairwise.manhattan_distances", | ||
| "sklearn.metrics.pairwise.nan_euclidean_distances", | ||
| "sklearn.metrics.pairwise.paired_cosine_distances", |
There was a problem hiding this comment.
I think this still needs to be reverted.
|
@Shreesha3112 since the core work is done, and all that remains is some small tidying, I wanted to remind you of this in case you'd still like to finish! |
@Micky774, @thomasjpfan Is this considered stalled ? I'll take a look at cleaning this up and finishing it since it appears @Shreesha3112 has gone dormant. Will start in the coming days if we get no response. |
|
@Sean-Jay-M are you working on this? |
Hey I'm not currently working on this. Trying to close out a different PR. Feel free to take the issue. I never got a response from the maintainers if it should be considered a stalled PR. I think should be considered stalled. |
|
Yes at this point the PR is stalled and continuation of the effort is welcomed! |
|
Closing this one, since the more recent PR #30537 is slightly more likely to be merged one day. Thanks for your work on this @Shreesha3112 anyway! |
Deprecates `paired_distances`, `paired_euclidean_distances`, `paired_manhattan_distances` and `paired_cosine_distances` in 1.10; removal scheduled for 1.12. Internal callers now use module-private `_paired_*` helpers to avoid triggering the deprecation warnings on their own use. The `PAIRED_DISTANCES` dict is kept (same name) and repointed to the private implementations. Continues the stalled work in scikit-learn#30537 (originally based on scikit-learn#27129). Co-authored-by: Success Moses <[email protected]> Co-authored-by: Shreesha Kumar Bhat <[email protected]>
Reference Issues/PRs
Fixes #26982
What does this implement/fix? Explain your changes.
Deprecates
metrics.pairwise.paired_*_distance functionsandmetrics.pairwise.paired_distancemetrics.pairwise.paired_euclidean_distancesmetrics.pairwise.paired_manhattan_distancesmetrics.pairwise.paired_cosine_distancesmetrics.pairwise.paired_distancesAny other comments?