## 3 Model Construction
### Model Parameters  
As for the non-time series model, the two-dimensional feature matrix compressed into a one-dimensional dense vector in the time dimension by the principal components analysis (PCA) algorithm, which can reduce the dimension to show the main components of feature data [42]. Then the time-series features extracted by the Tsfresh algorithm are added to non-time series model as the input [43]. The temporality of the compressed data is to be excluded from consideration, so that additional temporal features are added to the feature matrix as compensation.  
In addition, the cross-validation method is used to increase the robustness of the model [44], which can make the results more convincing by dividing the total sample into \(k\) mutually exclusive subsets and being trained accordingly. Figure 8 shows the schematic diagram of the five-fold cross-validation.  
For the time series model, the two-dimensional time series matrix sample needs to be constructed by the time-dimensional sliding window. The optimal model is preserved by observing the change in the loss function, through cross-validation. In terms of the cross-validation of time series data, the problem of data leakage needs to be considered, which needs to be addressed by sliding windows. The quality of the data directly affects the model prediction effect, and the amount of information contained is different in different time scales of the sliding window. If the time scale is too short, the amount of information obtained becomes insufficient. On the other hand, if the time scale is too long, it means that too much useless information must be obtained. Therefore, choosing a suitable sliding window is vital to the final results of the model.  
In terms of earthquake prediction, a problem is that there are usually more no-earthquake samples than samples with earthquakes. As a result, the prediction model tends to identify \"almost\" samples as no-earthquake samples to get a higher area under ROC curve (AUC) index. Therefore, it is necessary to introduce the receiver operating characteristic (ROC) curve when predicting earthquakes in order to make the prediction results more accurate. The ROC curve has the true positive rate (TPR) as the vertical axis and the false positive rate (FPR) as the horizontal axis. AUC is the area under the ROC curve. When the AUC is closer to 1, it indicates that the effect of prediction model is better [45; 46; 47]. The TPR, FPR, and AUC calculation method is defined as follows:  
\[\text{TPR}= \frac{\text{TP}}{\text{TP}+\text{FN}} \tag{18}\] \[\text{FPR}= \frac{\text{FP}}{\text{TN}+\text{FP}} \tag{19}\]  
Figure 8: Schematic diagram of five-fold cross-validation.  
\[\text{AUC}=\frac{1}{2}\sum_{i=1}^{m-1}\left(x_{i+1}-x_{i}\right)\cdot\left(y_{i} +y_{i+1}\right), \tag{20}\]  
where TP is true positive, FP is false positive, TN is true negative, FN is false negative, and \(x_{i+1}\), \(x_{i}\), \(y_{i}\), \(y_{i+1}\) represent the FPR and TPR under different thresholds of the ROC curve.  
Taking the processing of electromagnetic signals as an example, in this paper, eight control experiments were done for the sliding window time scale parameter with an interval of 5 days each time. This paper verifies the effect of the model and counts the number of stations with an AUC index greater than 0.65. It is obvious that the effect of the model increases at first but decreases as the time scale of the sliding window becomes longer. It achieves the best effect in the time range of [24 days, 30 days], and finally the sliding window size is set to 27 days for electromagnetic signals according to the results in Figure 9a. Similarly, the sliding window size is determined to be 10 days for the geoacoustic signals as shown in Figure 9b.