Skip to content
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

MAINT Move DistanceMetric under metrics #21177

Merged
merged 20 commits into from Oct 8, 2021

Conversation

jjerphan
Copy link
Member

@jjerphan jjerphan commented Sep 28, 2021

Reference Issues/PRs

Extracted from #20254.

What does this implement/fix? Explain your changes.

DistanceMetric was introduced with neighbors.*Tree. However, it is being used in other algorithms.
Also #20254 relies on DistanceMetric for its implementation in metrics.

This adds a deprecation cycle on this public interface.

For consistency, this moves DistanceMetric under metrics.

Any other comments?

Type definitions have also been moved to utils are they are being moved in several modules.

@jjerphan jjerphan marked this pull request as ready for review September 28, 2021 12:56
Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once the following is taken care of:

doc/modules/density.rst Show resolved Hide resolved
doc/whats_new/v1.1.rst Outdated Show resolved Hide resolved
sklearn/neighbors/_distance_metric.py Outdated Show resolved Hide resolved
sklearn/neighbors/tests/test_ball_tree.py Outdated Show resolved Hide resolved
sklearn/neighbors/tests/test_neighbors.py Outdated Show resolved Hide resolved
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
#cython: cdivision=True
# cython: boundscheck=False
# cython: cdivision=True
# cython: initializedcheck=False
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that checks settable via initializedcheck are activated by default.

I preferred to turned it off here: in practice, it does not change something but it might for new interfaces such as the ones introduced in #20254.

@jjerphan jjerphan requested a review from ogrisel October 8, 2021 08:42
doc/whats_new/v1.1.rst Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Show resolved Hide resolved
Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the suggested rephrasing to lighten a bit the docstring while making them more accurate.

sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
…ngly


Co-authored-by: Roman Yurchak <rth.yurchak@pm.me>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Copy link
Member

@rth rth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
sklearn/metrics/_dist_metrics.pyx Outdated Show resolved Hide resolved
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Roman Yurchak <rth.yurchak@pm.me>

Co-authored-by: Roman Yurchak <rth.yurchak@gmail.com>
Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 approvals. I think all comments have been resolved.
LGTM for me as well. Let's merge. Thanks @jjerphan !

@jeremiedbb jeremiedbb merged commit 6b332d9 into scikit-learn:main Oct 8, 2021
@glemaitre glemaitre mentioned this pull request Oct 23, 2021
10 tasks
samronsin pushed a commit to samronsin/scikit-learn that referenced this pull request Nov 30, 2021
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Dec 24, 2021
glemaitre pushed a commit that referenced this pull request Dec 25, 2021
@jjerphan jjerphan deleted the move-dist-metric-under-metrics branch October 21, 2022 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet