MachineLearning/kmeans library
🔶 k-Means Clustering (robust, production-minded)
A compact, well-documented implementation of k-means clustering with a
k-means++ initializer, configurable distance metric (Euclidean), and a
deterministic API that exposes fit, predict, and inertia.
Contract:
- Input: feature matrix
XasList<List<double>>(n x m), k clusters. - Output: learned centroids and integer labels for each point.
- Error modes: throws
ArgumentErroron invalid shapes or parameters.
Time Complexity: O(n * k * iters * m) Space Complexity: O(k * m + n)