Skip to main content
. 2024 Oct 19;9(10):643. doi: 10.3390/biomimetics9100643
Algorithm 4 bisecting K-means
Input:
       X1,,Xm– a set of points to be clustered;
       K–number of clusters;
Output:
  •   LC– a cluster list indicating the cluster assignments of the points;

  •  1:

    Initialize a list of cluster LC to contain the cluster consisting of all the points;

  •  2:

    repeat

  •  3:

       Remove the cluster C with the largest SSE from the list of clusters LC;

  •  4:

       {C1,C2}K-means(C,2)

  •  5:

       for i=2 to number of trials do

  •  6:

           {C1,C2}K-means(C,2)

  •  7:

           if SSE({C1,C2})<SSE({C1,C2}) then

  •  8:

              {C1,C2}{C1,C2}

  •  9:

         end if

  • 10:

       end for

  • 11:

       LCLC{C1,C2}

  • 12:

    until |LC|==K (the size of LC is equal to K)