フィルターのクリア

extract clusters based on the dendrogram

4 ビュー (過去 30 日間)
liangjian
liangjian 2011 年 12 月 6 日
回答済み: Mann Baidi 2024 年 4 月 29 日
In the generated dendrogram graph, the column marks the distance cutoff. Is there a way to get the cluster information for each of these distance cutoffs.

回答 (1 件)

Mann Baidi
Mann Baidi 2024 年 4 月 29 日
I assume that you would like to get th einformation of the cluster from the generated dendrogram plot.
You can find the details of the cluster using the output variable of the 'dendrogram' function. For getting the cluster assign to each data point, you can use the following line of code.
[~,T]=dendrogram(Z,distance_cutoff);
Here 'T' is an array which has the value assigned to each node in the data. For finding the number of nodes, each cluster has you can use the 'histogram' function in MATLAB for plotting the number of nodes in each of the cluster. For reference, you can take help of the foloowing code.
% Sample data
data = 10* rand(100, 2);
% Compute the linkage matrix using 'single' linkage method
Z = linkage(data, 'single');
% Define the distance cutoff
distance_cutoff = 20; % Example cutoff value, adjust as needed
[~,T]=dendrogram(Z,distance_cutoff);
figure;
histogram(T)
Hope I am able to help you in resloving the issue!

Community Treasure Hunt

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

Start Hunting!

Translated by