calculation of the distances between the features of the same cluster

2 ビュー (過去 30 日間)
pavlos
pavlos 2012 年 2 月 28 日
Hello,
The k-means syntax
[IDX,C,sumd,D] = kmeans(X,k)
allows you to calculate the
1. within-cluster sums of point-to-centroid distances (sumd)
2. distances from each point to every centroid (D)
How can I calculate the within-cluster sums of point-to-point?
I am referring to the distances between the features (points) that belong to the same cluster, not to the distances between the features and the centroids (sumd).
Also, how can I calculate the distances between the centroids?
Thank you very much.
Best,
Pavlos

回答 (2 件)

Tom Lane
Tom Lane 2012 年 2 月 28 日
Distances between pairs of points in cluster 1:
squareform(pdist(X(IDX==1,:)))
Use something similar to compute distances between pairs of points in C.

pavlos
pavlos 2012 年 2 月 29 日
Thank you sir.
Best,
Pavlos

Community Treasure Hunt

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

Start Hunting!

Translated by