[][src]Crate kmedoids

k-Medoids Clustering with the FasterPAM Algorithm

For details on the implemented FasterPAM algorithm, please see:

Erich Schubert, Peter J. Rousseeuw
Fast and Eager k-Medoids Clustering:
O(k) Runtime Improvement of the PAM, CLARA, and CLARANS Algorithms

Under review at Information Systems, Elsevier.
Preprint: https://arxiv.org/abs/2008.05171

Erich Schubert, Peter J. Rousseeuw:
Faster k-Medoids Clustering: Improving the PAM, CLARA, and CLARANS Algorithms
In: 12th International Conference on Similarity Search and Applications (SISAP 2019), 171-187.
https://doi.org/10.1007/978-3-030-32047-8_16
Preprint: https://arxiv.org/abs/1810.05691

This is a port of the original Java code from ELKI to Rust.

If you use this in scientific work, please consider citing above articles.

Example

Given a dissimilarity matrix of size 4 x 4, use:

let data = ndarray::arr2(&[[0,1,2,3],[1,0,4,5],[2,4,0,6],[3,5,6,0]]);
let mut meds = kmedoids::random_initialization(4, 2, &mut rand::thread_rng());
let (loss, numswap, numiter, assignment) = kmedoids::fasterpam(&data, &mut meds, 100);
println!("Loss is: {}", loss);

Re-exports

pub use crate::arrayadapter::ArrayAdapter;
pub use crate::safeadd::SafeAdd;

Modules

arrayadapter

Adapter trait for accessing different types of arrays.

safeadd

Add without overflow, for both integer and float types.

Functions

fasterpam

Run the FasterPAM algorithm.

random_initialization

Random initialization (requires the rand crate)