bundles / scipy latest / scipy / cluster / _vq / update_cluster_means
cython_function_or_method
scipy.cluster._vq:update_cluster_means
Signature
def update_cluster_means ( obs , labels , nc ) Summary
The update-step of K-means. Calculate the mean of observations in each cluster.
Parameters
obs: ndarrayThe observation matrix. Each row is an observation. Its dtype must be float32 or float64.
labels: ndarrayThe label of each observation. Must be a 1d array.
nc: intThe number of centroids.
Returns
cb: ndarrayThe new code book.
has_members: ndarrayA boolean array indicating which clusters have members.
Notes
The empty clusters will be set to all zeros and the corresponding elements in has_members will be False. The upper level function should decide how to deal with them.
Aliases
-
scipy.cluster._vq.update_cluster_means