scipy.cluster.hierarchy.centroid¶
-
scipy.cluster.hierarchy.centroid(y)[source]¶ Perform centroid/UPGMC linkage.
See
linkagefor more information on the input matrix, return structure, and algorithm.The following are common calling conventions:
Z = centroid(y)Performs centroid/UPGMC linkage on the condensed distance matrix
y.Z = centroid(X)Performs centroid/UPGMC linkage on the observation matrix
Xusing Euclidean distance as the distance metric.
Parameters: - y : ndarray
A condensed distance matrix. A condensed distance matrix is a flat array containing the upper triangular of the distance matrix. This is the form that
pdistreturns. Alternatively, a collection of m observation vectors in n dimensions may be passed as a m by n array.
Returns: - Z : ndarray
A linkage matrix containing the hierarchical clustering. See the
linkagefunction documentation for more information on its structure.
See also
linkage- for advanced creation of hierarchical clusterings.
