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: float, optional, :
verbose: verbosity mode, optionall : ninit: int, optional, number of random initalizations : |
---|---|
Returns: | Centers: array of shape (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 : |