#clustering #cluster #numbers #bindings #python-bindings #algorithm #mean-shift

meanshift-rs

Rust version of the MeanShift clustering algorithm that does not need a predefined number of clusters

6 releases

0.9.3 Oct 25, 2022
0.9.2 Oct 25, 2022
0.8.0 Jun 7, 2022
0.7.0 Jun 3, 2022

#1967 in Algorithms

28 downloads per month
Used in s2gpp

MIT license

49KB
1K SLoC

MeanShift-rs

pipeline status coverage report

Git tag

Install as Python Package

0. Minimum Requirements

  • rustc 1.54.0
  • Python 3.7

1. Create Python Environment

python3 -m venv .venv

2. Install MeanShift-rs

make install

or

pip install -r requirements.txt
bash ./tasks.sh release-install

or

pip install meanshift-rs

Usage

Rust

use meanshift_rs::{MeanShiftActor, Parameters};

fn example_fn(dataset: Array2<f64>) {
    let parameters = Parameters::default();
    let mut mean_shift = MeanShiftActor::init(parameters);
    let (centers, labels) = mean_shift.fit(dataset)
        .expect("No MeanShiftResult was returned!");
}

Python

from meanshift_rs import MeanShift

# ... load data

ms = MeanShift()
ms.fit(data)

print(ms.cluster_centers)
print(ms.labels)

Dependencies

~6–15MB
~190K SLoC