clump
Dense clustering primitives (k-means, DBSCAN, EVōC).
Dual-licensed under MIT or Apache-2.0.
Quickstart
[]
# Git dependency (main). Pin `rev` for reproducibility.
= { = "https://github.com/arclabs561/clump" }
use ;
use ;
let data = vec!;
// Hard clustering with k-means
let labels = new.with_seed.fit_predict.unwrap;
assert_eq!;
assert_eq!; // near each other
assert_ne!; // far apart
// Density clustering with DBSCAN
let labels = new.fit_predict.unwrap;
assert_eq!;
// Hierarchical clustering with EVōC (noise as `None`)
let mut evoc = new;
let labels = evoc.fit_predict.unwrap;
assert_eq!;
assert!;
Notes
Dbscan::fit_predictreturns a label for every point; noise points are assigned to a special cluster (clump::NOISE). If you wantOptionlabels, useDbscan::fit_predict_with_noise(or import theDbscanExttrait).Kmeans::fitreturns centroids + labels (KmeansFit), which you can reuse topredictlabels for new points.docs.rs/clumpcurrently documents the latest crates.io release. If you depend on git main, prefer local rustdoc (cargo doc --open) for up-to-date docs.
License
MIT OR Apache-2.0