-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
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
MAINT Introduce MiddleTermComputer
, an abstraction generalizing GEMMTermComputer
#24807
Conversation
There was a problem hiding this 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!
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp
Outdated
Show resolved
Hide resolved
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp
Outdated
Show resolved
Hide resolved
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp
Outdated
Show resolved
Hide resolved
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp
Outdated
Show resolved
Hide resolved
sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp
Outdated
Show resolved
Hide resolved
sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp
Outdated
Show resolved
Hide resolved
There were quite a lot of small fixes but I think all of them were taken care of thanks to cython-lint :) |
There was a problem hiding this 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.
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pxd.tp
Outdated
Show resolved
Hide resolved
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp
Outdated
Show resolved
Hide resolved
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp
Outdated
Show resolved
Hide resolved
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp
Outdated
Show resolved
Hide resolved
sklearn/metrics/_pairwise_distances_reduction/_middle_term_computer.pyx.tp
Outdated
Show resolved
Hide resolved
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
There was a problem hiding this 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/_middle_term_computer.pyx.tp
Outdated
Show resolved
Hide resolved
sklearn/metrics/_pairwise_distances_reduction/_radius_neighbors.pyx.tp
Outdated
Show resolved
Hide resolved
I went ahead an applied the nitpicks. Let's merge when green. |
MiddleTermComputer
, an abstraction generalizing GEMMTermComputer
…MMTermComputer` (scikit-learn#24807) Co-authored-by: Julien Jerphanion <git@jjerphan.xyz> Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
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.
GEMMTermComputer
with its abstractionMiddleTermComputer
.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.sqeuclidean_row_norm
for the same purpose._gemm_term_computer
files into_middle_term_computer
and propagate the renaming across the whole codebase.Any other comments?