## 2 Methodology
### Clustering
#### 2.2.2 Sparrow Search Algorithm  
The SSA algorithm is a heuristic optimization algorithm. The algorithm consists of followers, discoverers, and investigators [47]. The guidelines followed by the SSA algorithm are as follows:  
Assuming that the parameter being searched is 1d data, a group of \(n\) sparrows can be expressed by the following formula:  
\[\mathbf{X}=\left[ \begin{array}{cccc}x_{1}^{1}&x_{1}^{2}&\dots&x_{1}^{d}\\ x_{2}^{1}&x_{2}^{2}&\dots&x_{2}^{d}\\ \dots&\dots&\dots&\dots\\ x_{n}^{1}&x_{n}^{2}&\dots&x_{n}^{d}\end{array} \right] \tag{13}\]  
Here, \(d\) is the number of dimensions, and \(n\) is the number of sparrows. The fitness of the sparrow is expressed by Equation (14):  
\[\mathbf{F_{x}}=\left[ \begin{array}{c}f\bigg{(}\bigg{[}x_{1}^{1}x_{1}^{2} \dots x_{1}^{d}\bigg{]}\bigg{)}\\ f\bigg{(}\bigg{[}x_{2}^{1}x_{2}^{2}\dots x_{2}^{d}\bigg{]}\bigg{)}\\ \dots f\bigg{(}\bigg{[}x_{n}^{1}x_{n}^{2}\dots x_{n}^{d}\bigg{]}\bigg{)}\end{array} \right] \tag{14}\]  
Here, \(f\) denotes the adaptation value. For sparrow colonies, a discoverer with better adaptability provide an important resource for the entire colony and guide the predation direction of other sparrows in their predation:  
\[X_{i,j}^{t+1}= \begin{cases}X_{i,j}^{t}\cdot\exp\Bigl{(}-\frac{i}{\theta+id \tau_{\max}}\Bigr{)},if\ Q_{2}<ZD\\ X_{i,j}^{t}+R\cdot\mathbf{T},if\ Q_{2}\geq ZD\end{cases}  \tag{15}\]  
Here, \(X_{i,j}\) represents the position information of the \(i_{th}\) sparrow in the \(j_{th}\) dimension. \(t\) represents the current number of iterations, \(j=1,2,3,\cdots,d\). \(iter_{\max}\) represents the maximum number of iterations. \(\theta\in(0,1]\) is a random number. \(R\) stands for a random number that follows a normal distribution. \(\mathbf{T}\) represents a \(1\times d\) matrix with an element of 1. \(Q_{2}(Q_{2}\in[0,1])\) and \(ZD(ZD\in[0.5,1])\) indicate the alarm and safety values, respectively. When \(Q_{2}<ZD\), it indicates that no aggressor is found around the predation area, and the discoverer is able to perform an extensive search mechanism. If \(Q_{2}\geq ZD\), representing individuals in the group to spot the aggressor and sound the alarm, all individuals in the group take anti-predation behavior, and the discoverer will take the follower to a relatively safe position [48]. The position of the follower is updated as shown in the following equation:  
\[X_{i,j}^{t+1}= \begin{cases}R\cdot\exp\biggl{(}\frac{X_{i_{th}}^{t}-X_{i,j}^{t }}{i^{2}}\biggr{)},if\ i>n/2\\ X_{p}^{t+1}+\bigg{|}X_{i,j}^{t}-X_{p}^{t+1}\bigg{|}\cdot\mathbf{A^{+}}\cdot \mathbf{T},\ \text{otherwise}\end{cases}  \tag{16}\]  
\[\mathbf{A^{+}}=\mathbf{A^{T}}(\mathbf{AA^{T}})^{-1} \tag{17}\]Here, \(X_{us}\) represents the current global worst position and \(X_{p}\) represents the best position occupied by the discoverer. **A** represents \(1\times d\) matrix with a random value of 1 or \(-1\). When \(i>n/2\), it indicates that the \(i_{th}\) follower is in a position where there is less food and needs to go to a location where food is abundant. Sparrow colonies will defend themselves when they feel dangerous. The investigators were randomly selected individuals from the sparrow population. When predators appear in the vicinity of the population, they will promptly alert the entire population regarding the anti-predatory behavior, and the mathematical expression is as follows:  
\[X_{i,j}^{t+1}= \begin{cases}X_{bs}^{t}+\delta\cdot\left|X_{i,j}^{t}-X_{bs}^{t} \right|if\,f_{i}>f_{g}\\ X_{i,t}^{t}+M\cdot\left(\frac{\left|X_{i,j}^{t}-X_{us}^{t}\right|}{\left(f_{i}- f_{w}\right)+\kappa}\right),if\,f_{i}=f_{g}\end{cases}  \tag{18}\]  
Here \(X_{bs}\) represents the current global best position. \(\delta\) represents a random number that follows a standard normal distribution. \(\alpha\) represents a very small constant. \(M\in[-1,1]\) represents a random number. \(f_{i}\) indicates the adaptation value of the current sparrow. \(f_{w}\) and \(f_{g}\) represent the current global worst fitness and optimal fit, respectively.