Skip to main content
. 2022 Aug 15;22(16):6085. doi: 10.3390/s22166085
Algorithm 1: Coordinate Clustering based on K-Means
    Input: Cluster number, k; sample set, X = {X1, X2, …, XN};
    Output: Cluster center, C = {C1, C2, …, Ck};
    Randomly select k samples as the initial centroids {μ1, μ2, …, μk};
    Repeat
        Ci=,(1ik)
        for j = 1, 2, …, N do
          Calculate the distance between sample Xj and each mean vector μi(1ik): dij=Xjμi2;
          Determined the cluster market of Xj according to the nearest mean vector: λi=argmini{1,2,k}dij;
          Classify the sample Xj into the corresponding cluster: Cλj=Cλj{Xj};
      end for
      for i=1, 2, …, N do
          Calculate new mean vector: μi=1|Ci|XCiX;
        if μiμi then
            Update the current mean vector μi to μi;
        else
            Keep the current mean vector unchanged;
        end if
      end for
Until the current mean vector is not updated