| Crates.io | sklears-clustering |
| lib.rs | sklears-clustering |
| version | 0.1.0-beta.1 |
| created_at | 2025-10-13 12:53:25.09659+00 |
| updated_at | 2026-01-01 21:33:01.627802+00 |
| description | Clustering algorithms for sklears: K-means, DBSCAN, hierarchical clustering |
| homepage | https://github.com/cool-japan/sklears |
| repository | https://github.com/cool-japan/sklears |
| max_upload_size | |
| id | 1880487 |
| size | 1,585,637 |
Clustering algorithms for the sklears machine learning library.
Latest release:
0.1.0-beta.1(January 1, 2026). See the workspace release notes for highlights and upgrade guidance.
This crate provides implementations of clustering algorithms including:
[dependencies]
sklears = { version = "0.1.0-beta.1", features = ["clustering"] }
use sklears::cluster::KMeans;
use sklears::cluster::InitMethod;
let model = KMeans::new(3)
.init_method(InitMethod::KMeansPlusPlus)
.max_iter(300)
.n_init(10)
.random_state(42);
let fitted = model.fit(&data)?;
let labels = fitted.predict(&new_data)?;
let centers = fitted.cluster_centers();
use sklears::cluster::DBSCAN;
let model = DBSCAN::new()
.eps(0.5)
.min_samples(5)
.metric(Distance::Euclidean);
let labels = model.fit_predict(&data)?;
// -1 indicates noise points
Enable the optional gpu feature to experiment with WebGPU-powered distance kernels. GPU-backed tests are ignored by default because device discovery can be slow; run them explicitly when a compatible GPU is available:
cargo test -p sklears-clustering --features gpu -- --ignored gpu_distances::gpu::tests::test_gpu_distance_computation
The crate includes clustering metrics:
Licensed under either of Apache License, Version 2.0 or MIT license at your option.