Query regarding k-means clustering in MATLAB

前端 未结 2 488
-上瘾入骨i
-上瘾入骨i 2020-12-12 07:51

I have a very large amount of data in the form of matrix.I have already clustered it using k-means clustering in MATLAB R2013a. I want the exact coordinates of the centroid

2条回答
  •  暖寄归人
    2020-12-12 08:29

    The centroid is simply evaluated as the average value of all the points' coordinates that are assigned to that cluster.

    If you have the assignments {point;cluster} you can easily evaluate the centroid: let's say you have a given cluster with n points assigned to it and these points are a1,a2,...,an. You can evaluate the centroid for such cluster by using:

    centroid=(a1+a2+...+an)/n
    

    Obviously you can run this process in a loop, depending on how your data structure (i.e. the assignment point/centroid) is organized.

提交回复
热议问题