Skip to main content

Module kmeans

Module kmeans 

Source
Expand description

k-means clustering (ISL ch 12.4, PRML ch 9.1) — Lloyd’s algorithm with k-means++ seeding, over a row-major feature matrix.

Assign each point to its nearest centroid (squared Euclidean), recompute each centroid as the mean of its members, repeat to convergence. k-means++ seeding spreads the initial centroids to avoid poor local minima. Kernel-class AllPairs (the point↔centroid distances), dispatch-ready; deterministic given the seed.

Structs§

KMeansModel
A fitted k-means model.

Functions§

fit
Fit k-means with k clusters. Fails closed: InvalidDimension, InsufficientData (k == 0 or k > n).