kmedoids

Import in python using from mcot.core._scripts.parcel.random import kmedoids

mcot.core._scripts.parcel.random.kmedoids(distance, nclus=10, init='center', max_loops=6)[source]

Runs the k-medoids clustering algorithm.

based on Park & Jun (2008): http://www.sciencedirect.com/science/article/pii/S095741740800081X

Parameters:
  • distance – NxN distance matrix
  • nclus – number of clusters
  • init – initialization (‘random’ or ‘center’)
  • max_loops – maximum number of loops
Returns:

tuple with

  • centers: indices of the cluster centers
  • labels: N-length integer array of cluster labels