Return Euclidean distances from KMeans transform - #8539
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 SummarySummary by CodeRabbit
Walkthrough
ChangesKMeans distance correction
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to KMeans.transform now returns Euclidean distances compatible with scikit-learn, with regression coverage and the obsolete compatibility exclusion removed. No current merge-blocking risk is identified. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
viclafargue
left a comment
There was a problem hiding this comment.
Thanks for opening a PR!
|
/ok to test ad513a8 |
|
@Hashim1999164, the |
sklearn.cluster.tests.test_k_means::test_transform[42-KMeans] now passes under cuml.accel after Euclidean distances come from cuVS.
|
@viclafargue yeah that transform test is passing now so i pulled sklearn.cluster.tests.test_k_means::test_transform[42-KMeans] off the xfail list. |
Summary
KMeans.transform currently returns squared distances. sklearn returns Euclidean distances.
This change takes the square root of the transform output so the Python API matches sklearn. score is unchanged.
Fixes #8536
Test plan
Added a regression test against the six point example from the issue.