# Improved Honey Badger Algorithm and Its Application to K-Means Clustering
## 5 Simulation Experiment and Analysis
### Simulation Analysis of K-Means for Improved Honey Badger Algorithm
\begin{table}
\begin{tabular}{c c c c c c c c c c c c} \hline  & \multicolumn{4}{c}{**Iris**} & \multicolumn{4}{c}{**Wine**} & \multicolumn{4}{c}{**Glass**} \\ \cline{2-11}
**Algorithms** & **Best** & **Worst** & **Mean** & **Std.** & **Best** & **Worst** & **Mean** & **Std.** & **Best** & **Worst** & **Mean** & **Std.** \\ \hline K-means & 142.6 & 228.1 & 174.8 & 47.6 & 1287.0 & 1842.7 & 1045.4 & 43.9 & 837.0 & 1504.2 & 1105.0 & 114.2 \\ HBA-KM & 141.9 & 200.1 & 160.5 & 17.2 & 1278.5 & 1283.2 & 1279.5 & 1.3 & 810.1 & 1229.9 & 958.8 & 88.2 \\ IHBA-KM & 140.6 & 176.7 & 153.9 & 11.0 & 1278.4 & 1281.8 & 1278.9 & 0.74 & 810.6 & 1097.8 & 942.5 & 67.5 \\ \hline \end{tabular}
\end{table} 
Table 9: SSE comparison after running 30 times. Figure 7: Convergence curve of the algorithm on the data set. Comparing the results of the K-means algorithm, HBA-KM, and IHBA-KM, the IHBA-KM algorithm showed obvious advantages in many indexes. According to Table 9, it can be seen that the IHBA-KM in Iris data set was much less adaptive; in terms of standard deviation, IHBA-KM was 54.87 higher than K-means and 6.6 higher than HBA-KM, which strongly proves that the clustering stability and quality of IHBA-KM algorithm are better. It is evident from Figure 7 that the three algorithms exhibited rapid declines during the initial stages of iteration. The K-means algorithm and HBA-KM finally fell into local optimal, while IHBA-KM emerged from the trap in search of a higher-quality solution. The findings illustrate the efficacy of IHBA-KM in clustering within the data set. Especially in the Glass data set, IHBA-KM had the smallest fitness value, and it was found through the convergence curve that the comparison algorithm fell into local optimal rapid convergence, while IHBA-KM jumped out of the trap of local optimal and obtained better clustering centers. However, the standard deviation of 67.5 also indicated that the stability of IHBA was poor, suggesting that the improvement measures in this paper can enhance the clustering effect, but there is still room for improvement. In summary, IHBA-KM is superior to the traditional K-means algorithm and HBA-KM in terms of clustering effect, stability, and consistency. The experimental results show that the IHBA in this study can alleviate the influence of the initial clustering center on the clustering results and enhance the stability and efficiency of clustering. In order to further evaluate IHBA-KM, this study continued to explore the use of the accuracy and \(F\)-score metrics as criteria. Detailed results can be found in Tables 10 and 11. The IHBA-KM showed significant advantages in multiple clustering tasks, especially in the accuracy index. Taking the Iris data set as an example, the average accuracy of IHBA-KM was 89.63%, higher than that of the K-means algorithm (80.73%) and HBA-KM (88.00%). In addition, the maximum accuracy of IHBA-KM was also outstanding, reaching 96.66%. The performance of this algorithm was markedly superior to those of other algorithms, suggesting that it possesses a greater capacity for achieving optimal clustering results. In the context of the Wine data set, IHBA-KM demonstrated a consistently high accuracy rate, averaging approximately 10% higher and achieving a minimum improvement of 27% compared to the K-means algorithm. This indicates its robustness and the stability in its performance. In the Glass data set, the average accuracy of IHBA was 67.62%, while the average accuracy of HBA stood at 64.11%. This represents an improvement of 3.51%, highlighting the positive impact of the enhanced strategy on classification performance. This stability and high accuracy make IHBA-KM a more reliable choice in practical applications, especially in scenarios where high-precision clustering results are required. On the whole, the IHBA-KM algorithm has obvious advantages in terms of clustering effect and accuracy. As can be observed in Table 11, the IHBA-KM algorithm performed well on \(F\)-score indicators, especially on the Iris and Wine data sets.