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)[source]¶ 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 initilization 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, optionall
ninit: int, optional, number of random initalizations
- 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