Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MAINT Create private _pairwise_distances_reductions submodule #23724

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

Merged
merged 23 commits into from
Jun 24, 2022

Conversation

jjerphan
Copy link
Member

@jjerphan jjerphan commented Jun 22, 2022

Reference Issues/PRs

Follow-up of #23515.

What does this implement/fix? Explain your changes.

The single source file is split in several files to create a private submodule:

  • an extension per file (similarly to the tree submodule)
  • dispatchers are currently present with their associated implementation so as to be able to template implementation using Tempita
  • import paths have not changed for Python callers

Any other comments?

jjerphan and others added 14 commits June 1, 2022 18:13
Those interfaces are meant to be used in the Python code, decoupling the
actual implementation from the Python code. This allows changing all the
private implementation while maintaining a contract for the Python
callers.

Each interface extending the base `PairwiseDistancesReduction` interface
must implement the :meth:`compute` classmethod.

Under the hood, such a function must only define the logic to dispatch
at runtime to the correct dtype-specialized `PairwiseDistancesReduction`
implementation based on the dtype of X and of Y.

This refactoring will ease other dtype support such as float32 support.
… with some ASCII art. 🎨

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Also reword comments in tests
@jjerphan jjerphan marked this pull request as ready for review June 22, 2022 15:04
From: #14 (review)

Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.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.

I like the new organization. A lot more readable !

What's the purpose of having an empty test directory inside the _pairwise_distances_reduction sub-module ?

sklearn/metrics/_pairwise_distances_reduction/__init__.py Outdated Show resolved Hide resolved
Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com>
@jjerphan
Copy link
Member Author

I like the new organization. A lot more readable !

Thanks for the review. It definitely was time to.

What's the purpose of having an empty test directory inside the _pairwise_distances_reduction sub-module ?

Just a re-factoring left-over.

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!

sklearn/metrics/_pairwise_distances_reduction/__init__.py Outdated Show resolved Hide resolved
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

Thank you for the PR! I like the refactor.

sklearn/metrics/tests/test_pairwise_distances_reduction.py Outdated Show resolved Hide resolved
jjerphan and others added 5 commits June 23, 2022 17:12
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
…eds]

test_chunk_size_agnosticism
test_n_threads_agnosticism
test_strategies_consistency
test_pairwise_distances_argkmin
test_pairwise_distances_radius_neighbors
test_sqeuclidean_row_norms

Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
test_chunk_size_agnosticism
test_n_threads_agnosticism
test_strategies_consistency
test_pairwise_distances_argkmin
test_pairwise_distances_radius_neighbors
test_sqeuclidean_row_norms
Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

LGTM

@thomasjpfan thomasjpfan merged commit 325130f into scikit-learn:main Jun 24, 2022
@jjerphan jjerphan deleted the maint/pdr-private-submodule branch June 24, 2022 06:38
ogrisel added a commit to ogrisel/scikit-learn that referenced this pull request Jul 11, 2022
…it-learn#23724)

Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com>
Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
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.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.