Repository navigation
Conversation
KMeans(init="k-means++") and KMeans(init="random")KMeans(init="k-means++") and KMeans(init="random")
|
Just to make 100% sure: do you know about ogrisel/cursor-sandbox#17? I haven't had time to dig through it but I think we'd be able to find a lot of good stuff in that conversation and in Olivier's head (as always :D :D) |
I was aware of the sandbox before starting this POC, but I haven't gone through it in detail yet. I'll read it and come back with how this draft compares, and whether it's still useful alongside Olivier's work. |
|
Look at the "What the branch adds" section of the PR description in particular. |
|
In particular, my experiments used tiling which can significantly reduce memory usage. Memory efficiency is important to optimize, especially when using a GPU. Furthermore tiling can lead up to 3x speed-ups compared to the code in the current PR according to quick experiments run by my agent. My sandbox also includes a numerically stable fallback path in case of potential catastrophic cancellation of the GEMM-based euclidean distance computation. This is especially important when working on float32 data, especially if the data is not centered. Finally, after relocation, Cython's |
Reference Issues/PRs
Towards #35238, and a follow-up to the array API meeting on November 9, 2026
What does this implement/fix? Explain your changes.
This PR adds array API support and tests to
KMeans(init="k-means++")andKMeans(init="random").This is a proof of concept (PoC) intended to support the ongoing benchmarking efforts: https://github.com/probabl-ai/scikit-learn-benchmarks.
AI usage disclosure
I used AI assistance for:
Any other comments?
N / A