mirror of
https://gitlab.com/Kanedias/k-means-rust.git
synced 2026-04-30 15:50:49 +00:00
K-Means parallel algorithm implementation in rust
- Rust 100%
| src | ||
| test-datasets | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
K-Means in Rust
Parallel K-Means implementation written in Rust.
See here for the definition of a problem and possible algorithm implementations.
Building
In case you don't have Rust toolchain installed, use Rustup to quickly setup it.
Then just run cargo build --release inside the repo directory. The resulting binary
will be available in ./target/release/k-means.
Alternatively, you can use static binary which should work out of the box on any x86_64 GNU/Linux system.
Running
In order to test whether the binary works try sets in test-datasets folder.
The results should be like this:
$ ./target/release/k-means --clusters=2 --threads=4 test-datasets/small.txt
Data file read successfully, took 1 milliseconds
Commencing K-Means clustering, searching 2 clusters in 4000 points
K-Means converged after 2 iterations, took 0 milliseconds
Cluster 0: centroid coordinates: [180.01707500000012, 18.29], cluster size: 800
Cluster 1: centroid coordinates: [50.047634375000015, 8.82875], cluster size: 3200
License
Copyright (C) 2016-2019 Oleg `Kanedias` Chernovskiy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
