Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Clustering

solow-cluster ships 13 unsupervised clusterers covering centroid, density, hierarchical, spectral, and mixture-model families. Every stochastic clusterer is deterministic under a caller seed.

k-means and variants

EstimatorWhat it does
KMeansLloyd's k-means with k-means++ initialisation (Arthur-Vassilvitskii 2007), n_init restarts, deterministic MMIX-LCG seeding.
MiniBatchKMeansOnline mini-batch variant for large data with configurable batch size and momentum.
BisectingKMeansHierarchical bisecting split producing a balanced binary tree of clusters.

Density-based

EstimatorWhat it does
DbscanEster-Kriegel-Sander-Xu (KDD 1996) with per-point Core / Border / Noise roles.
HdbscanHierarchical density clustering with mutual reachability and condensed cluster tree.
OpticsOrdering points to identify the clustering structure, robust to varying densities.

Mode-seeking and graph-based

EstimatorWhat it does
MeanShiftKernel density mode-seeking with automatic bandwidth.
AffinityPropagationMessage-passing exemplar-based clustering with no preset k.
SpectralClusteringGraph-Laplacian eigenmap clustering with RBF, k-NN, or precomputed affinity.

Hierarchical

EstimatorWhat it does
AgglomerativeClusteringBottom-up merges with single, complete, average, or Ward linkage via Lance-Williams update recurrence. Reports the full dendrogram.
BirchStreaming clustering via the CF-tree summary structure.

Mixture models

EstimatorWhat it does
GaussianMixtureEM-fit Gaussian mixture with full, tied, diagonal, or spherical covariance.
BayesianGaussianMixtureVariational Bayesian Gaussian mixture with automatic component selection via a Dirichlet-process prior.

Example

#![allow(unused)]
fn main() {
use solow_cluster::{KMeans, KMeansInit};

let km = KMeans::new(3)
    .init(KMeansInit::KMeansPP)
    .n_init(10)
    .max_iter(300)
    .seed(42)
    .fit(&x)?;

let labels = km.predict(&x)?;
Ok::<_, solow_core::Error>(())
}

Correctness

Cross-verified against committed golden reference fixtures on every CI run. Fits are bit-for-bit reproducible under a caller seed.

References

  • Arthur, D., & Vassilvitskii, S. (2007). k-means++: The advantages of careful seeding. SODA '07, 1027-1035.
  • Ester, M., Kriegel, H.-P., Sander, J., & Xu, X. (1996). A density-based algorithm for discovering clusters in large spatial databases with noise. KDD-96, 226-231.