kmeans clustering algorithm
Parameters : | X: array of shape (n,p): n = number of items, p = dimension :
nbclusters (int), the number of desired clusters : Labels = None array of shape (n) prior Labels. :
maxiter=300 (int), the maximum number of iterations before convergence : delta=0.0001 (float), :
verbose=0: verbosity mode : ninit=1: number of random initalizations : |
---|---|
Returns : | Centers: array of size nbclusters*p, :
Labels : array of size n, the discrete labels of the input items J (float): the final value of the inertia criterion : |
Assignment of data items to nearest cluster center
Parameters : | x array of shape (n,p) :
centers, array of shape (k,p) the cluster centers : |
---|---|
Returns : | z vector of shape(n), the resulting assignment : |