best_kmeans(X)
[IDX,C,SUMD,K] = best_kmeans(X) partitions the points in the N-by-P data matrix X
into K clusters. Rows of X correspond to points, columns correspond to variables.
IDX containing the cluster indices of each point.
C is the K cluster centroids locations in the K-by-P matrix C.
SUMD are sums of point-to-centroid distances in the 1-by-K vector.
K is the number of cluster centriods determined using ELBOW method.
ELBOW method: computing the destortions under different cluster number counting from
1 to n, and K is the cluster number corresponding 90% percentage of
variance expained, which is the ratio of the between-group variance to
the total variance. see <http://en.wikipedia.org/wiki/Determining_the_number_of_clusters_in_a_data_set>
After find the best K clusters, IDX,C,SUMD are determined using kmeans
function in matlab.
Cite As
Feng Bao (2026). best_kmeans(X) (https://in.mathworks.com/matlabcentral/fileexchange/49489-best_kmeans-x), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
