8000 FIX Conditionally resolve metric deprecated by SciPy by jjerphan · Pull Request #25285 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

FIX Conditionally resolve metric deprecated by SciPy #25285

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

Conversation

jjerphan
Copy link
Member
@jjerphan jjerphan commented Jan 4, 2023

Reference Issues/PRs

Fixes #25202.
Alternative to #25212.

What does this implement/fix? Explain your changes.

SciPy might deprecated some distance metrics overtime, so with need to have condtional fallback for deprecated metrics. This is currently the case for "kulsinski".

This adds a fallback on DistanceMetric{,32}.

Note that for now, the newly introduced
DistanceMetric{,32} fallback has precedence over the scipy.spatial.distance fallback, but this must not be the case.

One way to remove this precedence would be to check for metric inclusion in a list equals to
scipy.spatial.distance._METRICS_NAMES (which can't be imported unfortunately 🙁 ).

Hence the proposed _SCIPY_DEPRECATED_METRICS.

Any other comments?

I guess we need to coordinate with the team of SciPy to correctly address distance metric resolution on the long term. What do you think?

SciPy might deprecated some distance metrics overtime,
so with need to have condtional fallback for deprecated
metrics. This is currently the case for `"kulczynski1"`.

This adds a fallback on `DistanceMetric{,32}`.

Note that for now, the newly introduced
`DistanceMetric{,32}` fallback has precedence over the
`scipy.spatial.distance` fallback, but this must not be
the case.

One way to remove this precedence would be to check
for metric inclusion in a list equals to
`scipy.spatial.distance._METRICS_NAMES` (which can't
be imported unfortunately :( ).

Hence the proposed `_SCIPY_DEPRECATED_METRICS`.
@glemaitre
Copy link
Member

I don't think this is the right fix, cf. #25212 (comment)

@jjerphan
Copy link
Member Author

Let's close this PR now that #25417 is merged.

We can reopen it if other metrics are deprecated by SciPy.

@jjerphan jjerphan closed this Jan 26, 2023
@jjerphan jjerphan deleted the fix/conditionally-resolve-scipy-deprecated-distance branch January 26, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

⚠️ CI failed on Linux_Nightly.pylatest_pip_scipy_dev ⚠️
2 participants
0