## 3 Methodology
### Ssa-Cnn-LSTM Fault Prediction Model
#### 3.4.2 SSA-CNN-LSTM Model  
In the sparrow search algorithm, the update of the producer's location can be illustrated as shown in Formula (14):  
\[r_{i,j}^{l+1}=\left\{ \begin{array}{ll}r_{i,j}^{t}\cdot e^{-\frac{i}{4\cdot t \mathit{max}}}&\quad if\ R_{2}<ST\\ r_{i,j}^{t}+P\cdot L&\quad if\ R_{2}\geq ST\end{array} \right. \tag{14}\]  
where \(t\) is the current epoch, \(j=1,2,3,\ldots,d\). \(\mathit{iter}_{max}\) is the largest epoch number. \(r_{i,j}\) denotes the sparrow's position information in dimension \(j\) at the \(i\) th iteration. \(R_{2}\in[0,1]\) and \(ST\in[0.5,1]\) represent the warning value and the safety value, respectively. \(\alpha\in(0,1)\) is a random number. \(P\) is a random number subject to a normal distribution. \(L\) is a matrix containing only values of \(1\). When \(R_{2}<ST\), this indicates the absence of immediate danger, allowing the scrounger to conduct searches across an extensive area. When \(R_{2}\geq ST\), this signifies the presence of a potential hazard, prompting the issuance of an alarm. Subsequently, the affected population is relocated to a secure area to ensure their safety. The update of the scrounger's location can be illustrated as shown in Formula (15):  
\[r_{i,j}^{t+1}= \begin{cases}Q\cdot e^{\frac{r_{\mathit{burst}}-r_{i,j}^{t}}{4 \cdot t\mathit{max}}}&\quad if\ i>\frac{n}{2}\\ r_{p}^{t+1}+\left|r_{i,j}^{t}-r_{p}^{t+1}\right|\cdot A^{+}\cdot L&\quad otherwise \end{cases}  \tag{15}\]  
where \(r_{p}\) is the optimal position occupied by the producer, and \(r_{\mathit{worst}}\) is the current global worst position. \(A\) is a \(1\times d\) matrix, and each element is randomly assigned \(1\) or \(-1\); \(A^{+}=A^{\top}\big{(}AA^{\top}\big{)}^{-1}\). When \(i>\frac{n}{2}\), this indicates that the \(i\) th scrounger with a lower fitness value is in a poor state and does not obtain food in a very hungry state. In threatening situations, certain species of sparrows exhibit anti-predatory behaviors. The dynamics of their location updates can be illustrated as shown in Formula (16):  
\[r_{i,j}^{t+1}=\left\{ \begin{array}{ll}r_{best}^{t}+\beta\cdot\left|r_{i,j}^ {t}-r_{best}^{t}\right|&\quad if\ f_{i}>f_{g}\\ r_{i,j}^{t}+K\cdot\left(\frac{\left|r_{i,j}^{t}-r_{\mathit{worst}}^{t}\right| }{\left(f_{i}-f_{\alpha}+\epsilon\right)}\right)&\quad if\ f_{i}=f_{g}\end{array} \right. \tag{16}\]  
where \(r_{best}\) denotes the present globally optimal position, and \(\beta\) acts as the step length's control factor, which adheres to a normal distribution of random numbers centered at \(0\) with a variance of \(1\). \(K\in[-1,1]\) represents a random number, while \(f_{i}\) signifies the current fitness value of an individual sparrow. \(f_{w}\) and \(f_{g}\) correspond to the worst and best fitness values. \(\epsilon\) serves as a minimal constant, preventing a zero denominator. \(K\) represents the motion direction of the sparrow and is used as a step control parameter [45]. The sparrow search algorithm evaluates the fitness value at each population update to ascertain the classification accuracy of the algorithm. In this study, the fitness value is defined as the reciprocal of the classification accuracy. The measurement of the classification accuracy can be articulated in the following manner:  
\[ACC=\frac{M}{N} \tag{17}\]  
where \(M\) is the number of predicted values and actual values that are the same, \(N\) is the total number of samples, and the fitness function is as follows:  
\[y=\frac{1}{ACC} \tag{18}\]  
In this study, an SSA-CNN-LSTM model is constructed by combining the sparrow search algorithm and the CNN-LSTM model. The operating mechanism of the SSA-CNN-LSTM model is shown in Figure 6 and can be described as follows [41]:Data preprocessing: Data annotation, dataset division, and data normalization. * SSA parameter initialization: The number of sparrows is set to \(n\), the number of producers is set to \(PD\), the number of sparrows perceiving danger is set to \(SD\), the safety threshold is set to \(ST\), and the alarm value is set to \(R_{2}\).