## 3 Improved DBSCAN Algorithm Based on Sparrow Search Algorithm
### Algorithm Pseudocode and Flowchart
The AMI value range is \([-1,1]\). When AMI > 0.5, it indicates that the clustering results are consistent with the true labels; when the AMI value is between 0.3 and 0.5, it indicates moderate and meaningful to some extent; and when AMI < 0.3, it may not make much sense as the clustering results are not consistent with the true labels. The ARI parameter takes into account the probability of chance, with a range of \([-1,1]\). Values closer to 1 suggest more accurate clustering results, values closer to 0 suggest that the clustering results are similar to random results, and values closer to \(-1\) indicate that the clustering results are completely opposite to the true categories. When ARI > 0.5, it indicates that the clustering is more consistent with the true category; when the ARI value is between 0.2 and 0.5, it indicates moderate effectiveness; and when ARI < 0.2, it indicates poor performance and clustering may not have practical significance. To evaluate the clustering performance of SSA-DBSCAN on real images, the probabilistic rand index (PRI) [30] and boundary displacement error (BDE) [31] are used for clustering quality assessment. The PRI value range is \([0,1]\), where a value of 0 indicates that the segmentation result of the test image is completely opposite to the ground truth and a value of 1 indicates that the segmentation results are identical at every pixel pair. When PRI > 0.8, the effect is \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Data** & **Observations** & **Classes** & **Dimensions** \\ \hline Aggregation & 788 & 7 & 2 \\ Compound & 399 & 6 & 2 \\ R15 & 600 & 15 & 2 \\ Spiral & 312 & 3 & 2 \\ Flame & 240 & 2 & 2 \\ \hline Iris & 150 & 3 & 4 \\ Wine & 178 & 3 & 13 \\ Sym & 350 & 3 & 2 \\ Seeds & 210 & 3 & 7 \\ Zoo & 101 & 7 & 16 \\ Bank & 1372 & 2 & 4 \\ Ecoli & 336 & 7 & 8 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Experiment datasets. good, indicating that there is basically no confusion in clustering; when the PRI value is between 0.6 and 0.8, it indicates that the effect is moderate and needs to be judged based on the application scenario; and when PRI! 0.6, it indicates that there are a large number of outliers mixed in the clustering, which may not be ideal. The BDE value is typically above 1; the lower the metric, the better the image segmentation performance. BDE generally does not have a universal boundary and needs to be considered based on specific tasks and data resolution. Generally speaking, the smaller, the better. ### Analysis of Experimental Results on Synthetic Datasets

To further verify the effectiveness and advancement of the improved algorithm, cluster analysis was carried out on the artificial dataset and the results obtained by the proposed algorithm were compared with the results of four comparative algorithms. Figure 4 illustrates the performance of different algorithms on various synthetic datasets. Except for the DBSCAN algorithm, the parameters of the other four algorithms can be adaptively calculated. In contrast, the parameters for DBSCAN need to be manually input and optimized. The aggregation dataset represents a density-homogeneous, cluster-connected dataset. All four algorithms have shown relatively accurate clustering results when clustering this specific dataset. Nevertheless, the AF-DBSCAN algorithm, which adapts parameters through polynomial fitting, can only identify some accurate clusters and fails to effectively separate clusters when they are connected. The compound dataset exhibits clusters of uneven density and diverse shapes, interspersed with distinct data points. Algorithms such as SSA-DBSCAN, KANN-DBSCAN, and the original DBSCAN can discern these clusters effectively, even though occasional points may be tagged as noise or mislabeled. AF-DBSCAN fails to ensure the effective identification of clusters and is prone to errors, such as misidentifying a single cluster, resulting in the lowest accuracy. Figure 4: Clustering results of different algorithms on synthetic datasets.