# Clustering Using an Improved Krill Herd Algorithm
## 5 Simulation and Experiment  
To investigate the performance of IKHCA, five clustering algorithms, namely, K-means [34], ACO [35], PSO [36], KHCA I in [30], and KHCA II, were compared. KHCA II is a clustering algorithm based on KHA [19]. Five datasets obtained from UCI Machine Learning Repository [37] were used in our experiment. The details of the data sets, including the name, number of classes, attributes, and records are presented in Table 1. Our experiments were conducted on Eclipse 4.6.0 with Windows 7 environment using Intel Core i7, 3.40 GHz, and 4 GB RAM. \begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Name**} & \multicolumn{3}{c}{**Number of**} \\ \cline{2-4}  & **Clusters** & **Parameters** & **Elements** \\ \hline Iris & 3 & 4 & 150 \\ Wine & 3 & 13 & 178 \\ Glass & 6 & 9 & 214 \\ Cancer & 2 & 9 & 683 \\ CMC & 3 & 10 & 1473 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The details of selected datasets. Before the experiment, the setting of the parameters and the selection of the objective functions in KHCA II and IKHCA were specified. In KHCA II and IKHCA, we used the sum of squared error (\(I_{SSE}\)) as the objective function directly, the formula is indicated in Equation (25). The low value of \(I_{SSE}\), the higher the quality of the clustering is  
\[I_{SSE}=\sum_{k=1}^{K}\sum_{i=1}^{n}\omega_{ik}(dis(data_{i},C_{k}))^{2} \tag{25}\]  
\[\omega_{ik}=\left\{ \begin{array}{l}1,\text{if data }i\text{ belongs to cluster }k\\ 0,\text{else}\end{array} \right\} \tag{26}\]  
The parameters are set in accordance with [19; 38]:  
\(N^{\text{max}}=0.01\);  
\(V_{f}=0.02\); and  
\(D^{\text{max}}=0.005\). Here, \(C_{t}\) is set to 0.5, and the inertia weights \(\left(\omega_{n},\omega_{f}\right)\) are equal to 0.9 at the beginning of the search, and linearly decreased to 0.1 at the end to encourage exploitation. The size of the population is set to 25, \(s_{\text{max}}=5\), \(\
u_{best}=0.5\) at the beginning, and linearly decreased to 0.1 at the end in IKHCA. We compared the performance of different clustering algorithms from two aspects. First, we compared the objective function value of the different clustering algorithms in Table 2, and then we compared the accuracy of different clustering algorithms in Table 3. Accuracy is specifically expressed as follows:  
\[\text{accuracy}=\left(\frac{\text{number of correctly placed data}}{\text{total number of data}}\right)\times 100 \tag{27}\]  
Table 2 lists the best and worst means of the solution, and ranks the algorithms based on the mean values for all datasets in Table 1. As compared, algorithm results are directly taken from [30]. KHCA II and IKHCA algorithms were executed 100 times independently with the same parameters described in this paper, except that the maximum number of generations was set to 200. As shown in Table 2, IKHCA obtained better solutions for the best and worse than other algorithms on the Wine, Glass, Cancer, and CMC datasets, but not on Iris. KHCA II obtained the first solution for best on the Iris dataset. However, KHCA II generated a poor solution for the worst with respect to the Iris dataset. Then, we observed that IKHCA achieved the best solutions from mean values on all datasets, except Glass. However, IKHCA is very close to the results obtained by the KHCA II algorithm on the Glass dataset. From the experimental results, our proposed algorithm achieved better optimal solutions with improved stability in a limited number of iterations. IKHCA ranked first in all algorithms.