[][src]Function kmedoids::fasterpam

pub fn fasterpam<N: NumAssignOps + Signed + Zero + PartialOrd + Copy + SafeAdd>(
    mat: &Array2<N>,
    med: &mut Vec<usize>,
    maxiter: usize
) -> (N, usize, usize, Vec<usize>)

Run the FasterPAM algorithm.

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

let mut rng = rand::thread_rng();
let mut meds = random_initialization(n, k, &mut rng);
let (loss, numswap, numiter, assignment) = fasterpam(data, &mut meds, 100);
  • type N - some signed data type such as i32 or f64
  • mat - a pairwise distance matrix
  • med - the list of medoids
  • maxiter - the maximum number of iterations allowed

returns a tuple containing:

  • the final loss
  • the number of swaps performed
  • the number of iterations needed
  • the final cluster assignment