This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

ClusteringComponents

ClusteringComponents[array]
gives an array in which each element of array is replaced by an integer index representing the cluster in which the element lies.
ClusteringComponents
finds at most n clusters.
ClusteringComponents
finds clusters at the specified level in array.
ClusteringComponents[image]
finds clusters of pixels with similar values in image.
ClusteringComponents
finds at most n clusters in image.
  • Other distance functions can be specified by setting the DistanceFunction option. Possible settings are:
ManhattanDistanceManhattan or "city block" distance
EuclideanDistanceEuclidean distance
SquaredEuclideanDistancesquared Euclidean distance
NormalizedSquaredEuclideanDistancenormalized squared Euclidean distance
CosineDistanceangular cosine distance
CorrelationDistancecorrelation coefficient distance
  • A Method option can be used to specify different methods of clustering. Possible settings include:
"Agglomerate"find clustering hierarchically
"Optimize"find clustering by local optimization
"KMeans"-means clustering algorithm
"PAM"find clustering by partitioning around medoids
  • ClusteringComponents accepts a option that is used to control the creation of the initial set of seeds.
Label two clusters of values in a list:
Clustering transform of nested lists:
Cluster analysis of an MR image:
Find a color segmentation of a satellite image:
Label two clusters of values in a list:
In[1]:=
Click for copyable input
Out[1]=
 
Clustering transform of nested lists:
In[1]:=
Click for copyable input
Out[1]=
 
Cluster analysis of an MR image:
In[1]:=
Click for copyable input
Out[1]=
 
Find a color segmentation of a satellite image:
In[1]:=
Click for copyable input
Out[1]=
Clusters of values in a matrix:
Find color clusters in an image:
Find clusters at list level 2:
Find clusters at list level 1:
Find duplicates by specifying a large number of clusters:
Labeling clusters in a matrix:
Color segmentation of a microscopic image, after smoothing with a Perona-Malik filter:
New in 8