Function Reference: clusterdata

statistics: T = clusterdata (X, cutoff)
statistics: T = clusterdata (X, Name, Value)

Wrapper function for linkage and cluster.

If cutoff is used, then clusterdata calls linkage and cluster with default value, using cutoff as a threshold value for cluster. If cutoff is an integer and greater or equal to 2, then cutoff is interpreted as the maximum number of cluster desired and the "MaxClust" option is used for cluster.

If cutoff is not used, then clusterdata expects a list of pair arguments. Then you must specify either the "Cutoff" or "MaxClust" option for cluster. The method and metric used by linkage, are defined through the "linkage" and "distance" arguments.

See also: cluster, dendrogram, inconsistent, kmeans, linkage, pdist

Source Code: clusterdata

Example: 1

 

 randn ("seed", 1)  # for reproducibility
 r1 = randn (10, 2) * 0.25 + 1;
 randn ("seed", 5)  # for reproducibility
 r2 = randn (20, 2) * 0.5 - 1;
 X = [r1; r2];

 wnl = warning ("off", "Octave:linkage_savemem", "local");
 T = clusterdata (X, "linkage", "ward", "MaxClust", 2);
 scatter (X(:,1), X(:,2), 36, T, "filled");

                    
plotted figure