[][src]Function kmeans_colors::get_kmeans

pub fn get_kmeans<C: Calculate + Clone>(
    k: usize,
    max_iter: usize,
    converge: f32,
    verbose: bool,
    buf: &[C],
    seed: u64
) -> Kmeans<C>

Find the k-means centroids of a buffer.

max_iter and converge are used together to determine when the k-means calculation has converged. When the score is less than converge or the number of iterations reaches max_iter, the calculation is complete.

  • k - number of clusters.
  • max_iter - maximum number of iterations.
  • converge - threshold for convergence.
  • verbose - flag for printing convergence information to console.
  • buf - array of points.
  • seed - seed for the random number generator.