This is documentation for an old release of SciPy (version 0.10.1). Read this page Search for this page in the documentation of the latest stable release (version 1.15.1).
scipy.cluster.hierarchy.fclusterdata
-
scipy.cluster.hierarchy.fclusterdata(X, t, criterion='inconsistent', metric='euclidean', depth=2, method='single', R=None)
Cluster observation data using a given metric.
Clusters the original observations in the n-by-m data
matrix X (n observations in m dimensions), using the euclidean
distance metric to calculate distances between original observations,
performs hierarchical clustering using the single linkage algorithm,
and forms flat clusters using the inconsistency method with t as the
cut-off threshold.
A one-dimensional array T of length n is returned. T[i] is the index
of the flat cluster to which the original observation i belongs.
Parameters : | X : ndarray
n by m data matrix with n observations in m dimensions.
t : float
The threshold to apply when forming flat clusters.
criterion : str, optional
Specifies the criterion for forming flat clusters. Valid
values are ‘inconsistent’ (default), ‘distance’, or ‘maxclust’
cluster formation algorithms. See fcluster for descriptions.
method : str, optional
The linkage method to use (single, complete, average,
weighted, median centroid, ward). See linkage for more
information. Default is “single”.
metric : str, optional
The distance metric for calculating pairwise distances. See
distance.pdist for descriptions and linkage to verify
compatibility with the linkage method.
t : double, optional
The cut-off threshold for the cluster function or the
maximum number of clusters (criterion=’maxclust’).
depth : int, optional
The maximum depth for the inconsistency calculation. See
inconsistent for more information.
R : ndarray, optional
The inconsistency matrix. It will be computed if necessary
if it is not passed.
|
Returns : | T : ndarray
A vector of length n. T[i] is the flat cluster number to
which original observation i belongs.
|
Notes
This function is similar to the MATLAB function clusterdata.