Returning Cutoff Distance Using Cluster Function Given nClusters

4 visualizaciones (últimos 30 días)
Adam Cutbill
Adam Cutbill el 18 de Mzo. de 2014
Editada: Adam Cutbill el 18 de Mzo. de 2014
Hello all,
If you have used agglomerative clustering in MATLAB, you know there are two options for stopping the clustering.
The first option is to specify a "cutoff distance" (commonly 'epsilon' in literature). In this case, the clustering will stop once clusters are far enough apart, and return a vector of cluster labels for each point (e.g. [1 2 1 1 ...]).
The second option is to specify "maximum clusters" (commonly 'k' or 'c' in literature). In this case, the clustering will stop once the clusters have merged into a specified number of clusters and return a vector of clusters for each point. For example, if 2 is specified, the algorithm will continue to merge clusters until it hits 2.
My question is: Can I return the 'epsilon' value corresponding to the maximum clusters? For example, if max clusters is two, I want to know what the minimum distance to get to two clusters. This is a simple task, and I've written my own linkage clustering to do it. However, MATLAB's implementation is understandably much faster than what I wrote. Therefore, I'd like to have MATLAB do this for me.
Note: I don't want a dendrogram. I need a numeric value.
This is the code I wrote to call the MATLAB clustering.
function clusters=singleLinkMATLAB(dataset,clusterCutoffType,cutoffParameter,distanceType)
Z=linkage(dataset,'single',distanceType);
if clusterCutoffType==0
clusters=cluster(Z,'cutoff',cutoffParameter,'criterion','distance');
elseif clusterCutoffType==1
clusters=cluster(Z,'maxclusters',cutoffParameter);
end
end

Respuestas (0)

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by