# \(K\)-Means Cloning: Adaptive Spherical \(K\)-Means Clustering
## 2 K-Means Cluster Cloning
### K-Means Colony Growth
#### 2.3.1 Evaluating the Number of Clusters  
It is instructive to see how clustering objective function \(SF(K)\) changes with respect to the change of \(K\), the number of clusters. During our experiments, we discovered that the performance of \(SF(K)\) measure moves towards the best solution (optimum number of clusters) smoothly. \(SF(K)\) was sequentially applied to several dataset with the number of clusters ranging from 2 to \(K_{max}=min(20,\sqrt{n})\). SA was run many times starting with initial fixed number \(K\), \(K=2,\ldots,K_{max}\), using Dataset 3-2 and Dataset 10-2. The best values obtained with maximum \(SF(K)\) measure were stored. The final outcome of these calculations and the performance of \(SF(K)\) are shown in Figure 2.  
In Figure 1(a) the peak begin when \(K=2\) and minimum \(SF(K)\), then starts increasing with the increase of the number of clusters and \(SF(K)\) together for Dataset 3-2. \(SF(K)\) continues to increase until it reaches the maximum value when the maximum peak is reached for \(SF(3)=0.856\). Then, \(SF(K)\) begin to decline with continued increase of the number of clusters. Similarly, the maximum peak for the Dataset 10-2 is reached when \(SF(10)=0.7664\), as shown in Figure 1(b).  
These obtained values comply with the common sense evaluation of the data by visual inspection. Also the well-known Ruspini dataset [72], has been widely used as a benchmark for clustering algorithms, the maximum peaks are achieved when \(K=4\), see [71]. We need two values for the number of clusters, the initial number \(K\) and random \(K+1\) with two \(SF(K)\) values. By comparing the two \(SF(K)\) values for two values of number clusters, the next step whether of merging or splitting process is determined. The following procedure illustrates this process.  
**Procedure 1**.: \(K\)_-Adaptation_  
1. _Input: two clustering outputs_ \(C^{1}\) _and_ \(C^{2}\) _with_ \(K_{1}\) _and_ \(K_{2}\) _clusters, respectively, with_ \(K_{1}\leq K_{2}\)_._
2. _If_ \(K_{1}=K_{2}\)_, then apply cluster merging (Procedure 2) or cluster splitting (Procedure 3) randomly in order to get different cluster numbers. Rename the obtained clusters to ensure that_ \(K_{1}<K_{2}\)_._
3. _Evaluation: compute_ \(\operatorname{SF}(K_{1})\) _and_ \(\operatorname{SF}(K_{2})\)_._
4. _Merging: if_ \(\operatorname{SF}(K_{1})>\operatorname{SF}(K_{2})\)_, then apply cluster merging (Procedure 2) on_ \(C^{1}\)_, to produce_ \(K_{1}-1\) _clusters. Set_ \(K:=K_{1}-1\)_, and return._
5. _Splitting: if_ \(\operatorname{SF}(K_{1})<\operatorname{SF}(K_{2})\)_, then apply cluster splitting (Procedure 3) on_ \(C^{2}\)_, to produce_ \(K_{2}+1\) _clusters. Set_ \(K:=K_{2}+1\)_, and return._  
Figure 2: The silhouette function performance to (**a**) Dataset 3-2 and (**b**) Dataset 10-2, when the number of clusters changes from 2 to \(K_{max}\).  
_Neutral: randomly apply the cluster merging or splitting procedure on \(C^{1}\) or \(C^{2}\) to produce new clusters, and return._  
Accordingly, a decision is taken using SF by either merging two smaller clusters into a larger one or splitting a larger cluster into smaller ones.