[REVIEW] Add KMeans.fit_predict to Python API#1956
Open
jrbourbeau wants to merge 2 commits intorapidsai:mainfrom
Open
[REVIEW] Add KMeans.fit_predict to Python API#1956jrbourbeau wants to merge 2 commits intorapidsai:mainfrom
KMeans.fit_predict to Python API#1956jrbourbeau wants to merge 2 commits intorapidsai:mainfrom
Conversation
Signed-off-by: James Bourbeau <jbourbeau@nvidia.com>
…it_predict_python Signed-off-by: James Bourbeau <jbourbeau@nvidia.com>
lowener
requested changes
Mar 25, 2026
Comment on lines
+307
to
+323
| centroids_out, _, n_iter = fit( | ||
| params, | ||
| X, | ||
| centroids=centroids, | ||
| sample_weights=sample_weights, | ||
| resources=resources, | ||
| ) | ||
| labels_out, inertia_pred = predict( | ||
| params, | ||
| X, | ||
| centroids_out, | ||
| sample_weights=sample_weights, | ||
| labels=labels, | ||
| normalize_weight=normalize_weight, | ||
| resources=resources, | ||
| ) | ||
| return FitPredictOutput(labels_out, centroids_out, inertia_pred, n_iter) |
Contributor
There was a problem hiding this comment.
This would need to call the missing C function "cuvsKMeansFitPredict" because #1939 is adding some improvements to the fit_predict function that make it run faster than calling independantly both functions.
Member
Author
Member
There was a problem hiding this comment.
@jrbourbeau, given that we're likely to merge @lowener's PR first in sequence, could you base your branch on his and build from his changes? Then we can merge yours in shortly after.
Contributor
There was a problem hiding this comment.
FYI the latest update on #1939 is that the C++ fit_predict() function will be removed and the labels will be returned as part of the fit() function as an optionnal output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR handles the Python portion of #1944