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

Download history 154/week @ 2024-10-14 7/week @ 2024-10-21 6/week @ 2024-11-04 393/week @ 2024-12-02

394 downloads per month

Apache-2.0

56KB
1.5K SLoC

gathers

CI crates.io docs.rs

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

Check the docs and main.rs.


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), &centroids, dim, &mut labels);

Dependencies

~11–19MB
~309K SLoC