4 releases (2 breaking)
0.3.1 | Dec 4, 2024 |
---|---|
0.3.0 | Dec 4, 2024 |
0.2.0 | Dec 3, 2024 |
0.1.0 | Oct 17, 2024 |
#291 in Machine learning
394 downloads per month
56KB
1.5K
SLoC
gathers
Clustering algorithm implementation in Rust and binding to Python.
For Python users, check the Python README.
- K-means
- PyO3 binding
- RaBitQ assignment
- Parallel with Rayon
-
x86
&x86_64
SIMD acceleration - mini batch K-means
- Hierarchical K-means
-
arm
&aarch64
SIMD acceleration
Installation
cargo add gathers
Usage
lib.rs
:
Clustering algorithms for Rust.
Examples
use gathers::kmeans::{KMeans, rabitq_assign};
use gathers::utils::as_continuous_vec;
let kmeans = KMeans::default();
let num = vecs.len();
let dim = vecs[0].len();
// fit
let centroids = kmeans.fit(as_continuous_vec(&vecs), dim);
// predict
let mut labels = vec![0; num];
rabitq_assign(&as_continuous_vec(&vecs), ¢roids, dim, &mut labels);
Dependencies
~11–19MB
~309K SLoC