# algorithms.clustering.utils

## Module: `algorithms.clustering.utils`

## Functions

nipy.algorithms.clustering.utils.kmeans(X, nbclusters=2, Labels=None, maxiter=300, delta=0.0001, verbose=0, ninit=1)

  kmeans clustering algorithm

  Parameters:
    X: array of shape (n,p): n = number of items, p = dimension

      data array

    nbclusters (int), the number of desired clusters
    Labels = None array of shape (n) prior Labels.

      if None or inadequate a random initialization is performed.

    maxiter=300 (int), the maximum number of iterations before convergence
    delta: float, optional,

      the relative increment in the results before declaring convergence.

    verbose: verbosity mode, optional
    ninit: int, optional, number of random initializations
  Returns:
    Centers: array of shape (nbclusters, p),

      the centroids of the resulting clusters

    Labels array of size n, the discrete labels of the input items
    J (float): the final value of the inertia criterion

nipy.algorithms.clustering.utils.voronoi(x, centers)

  Assignment of data items to nearest cluster center

  Parameters:
    x array of shape (n,p)

      n = number of items, p = data dimension

    centers, array of shape (k, p) the cluster centers
  Returns:
    z vector of shape(n), the resulting assignment