8000 MAINT Introduce `MiddleTermComputer`, an abstraction generalizing `GEMMTermComputer` by Vincent-Maladiere · Pull Request #24807 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

MAINT Introduce MiddleTermComputer, an abstraction generalizing GEMMTermComputer #24807

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

Vincent-Maladiere
Copy link
Contributor

Reference Issues/PRs

This PR factorizes the boilerplate and logic from #24556 to ease the review. This must be merged before #24556. @jjerphan

What does this implement/fix? Explain your changes.

  • Replace GEMMTermComputer with its abstraction MiddleTermComputer. GEMMTermComputer currently only handles Dense x Dense matrix multiplication for the decomposition of the Euclidean distance. GEMMTermComputer however can be subclassed to generalize to all format combinations: Dense x Dense, CSR x CSR, Dense x CSR and CSR x Dense.
  • Add sqeuclidean_row_norm for the same purpose.
  • Rename the _gemm_term_computer files into _middle_term_computer and propagate the renaming across the whole codebase.

Any other comments?

Copy link
Member
@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

Thanks, @Vincent-Maladiere!

A few suggestions and this LGTM.

PS: https://github.com/MarcoGorelli/cython-lint/ comes in handy to check for any unused symbol — once again let's thank @MarcoGorelli!

@Vincent-Maladiere
Copy link
Contributor Author

There were quite a lot of small fixes but I think all of them were taken care of thanks to cython-lint :)

Copy link
Member
@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

LGTM modulo a few suggestions.

Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
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!

@ogrisel
Copy link
Member
ogrisel commented Nov 3, 2022

I went ahead an applied the nitpicks. Let's merge when green.

@jjerphan jjerphan changed the title EHN Sparse-Sparse support for EuclideanArgKmin and EuclideanRadiusNeighbors [1/2] MAINT Introduce MiddleTermComputer, an abstraction generalizing GEMMTermComputer Nov 3, 2022
@jjerphan jjerphan merged commit 239e163 into scikit-learn:main Nov 3, 2022
andportnoy pushed a commit to andportnoy/scikit-learn that referenced this pull request Nov 5, 2022
…MMTermComputer` (scikit-learn#24807)

Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
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.

3 participants
0