# An Earthquake Forecast Model Based on Multi-Station PCA Algorithm
## 5 Earthquake Prediction Model
### Experiment  
In this work, the used area is a rectangle in 98\({}^{\circ}\) E\(\sim\)106.2\({}^{\circ}\) E and 28.1\({}^{\circ}\) N\(\sim\)34\({}^{\circ}\) N. The time range of the training data set is from 1 July 2019 to 1 March 2021, and the time range of the testing data set is from 1 March 2021 to 31 December 2021. The distribution of data is shown in Table 1. The corresponding earthquakes of the testing data set are listed in Table 2, while their number is 63. The corresponding stations are listed in Table 3. The sliding window time step of the training data is 1 day, and the sliding window time step of the testing data is 4 days. If magnitude Ms3.5 is regarded as the threshold of positive and negative, the number of positive samples in the train set is 393, the number of negative samples in the train set is 216, the number of positive samples in the test set is 37, and the number of negative samples in the test set is 32. The distribution of train set and test set is different especially in earthquakes whose magnitudes are beyond 4.5, such as the Ms6.4 earthquake on 21 May 2021 and its aftershocks, which are shown in Table 2. The difference is a big challenge for the generalization performance of the model and shows the complexity of earthquake prediction.  
It is easy to find that the data are unbalanced from Table 1, so we expand the unique labels 3, 4, and 5 in the train data by copying them into the train data several times. Label 3 is copied one time, label 4 is copied three times, and label 5 is copied five times.  
The LightGBM algorithm is a machine learning algorithm with lots of super parameters that need to be set up manually, and the best values according to the experiment need to be chosen as well. In this work, the super parameters that we changed include the learning rate (Lr), Num-leaves, and max-depth. Lr is a super parameter that controls the speed of updating internal parameters of the model, Num-leaves and max depth control the complexity of the model. Generally, a bigger Lr means faster and rough updating, and a bigger Num-leaves and bigger max-depth mean a more complex model. We use the grid search method, which generates all possible super parameter combinations and tests them one by one. Lr is chosen from [0.0001, 0.001, 0.01, 0.1, 0.5], Num-leaves is chosen from [3; 5; 8; 12; 16; 20], and max-depth is chosen from [3; 5; 8; 12; 16; 20; 25].  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Label** & **Level** & **Number in TrainSet** & **Number in TestSet** \\ \hline
0 & No Earthquake & 209 & 25 \\
1 & Ms0+\(\sim\)Ms3.5 & 184 & 12 \\
2 & Ms3.5\(\sim\)Ms4.0 & 120 & 11 \\
3 & Ms4.0\(\sim\)Ms4.5 & 50 & 13 \\
4 & Ms4.5\(\sim\)Ms5.0 & 35 & 2 \\
5 & Ms5.0+ & 11 & 6 \\ Total & & 609 & 69 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Table shows the distribution of samples in the data set.  
Figure 7: The structure of LightGBM model (LGB). LGB is a kind of implementation of Gradient Boosting Decision Tree that is widely used in various machine learning tasks.  
In the experiment, we use a random train set to run a control group experiment. To ensure the authenticity of the data, the random data share the same source with the true train set, which is not shuffled, and the relationship between data and label is shuffled. This  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Time** & **Magnitude/Ms** & **Latitude/North** & **Longitude/East** \\ \hline  
ecember 2021 5:39 random train set is trained in the same environment of true train set and super parameters and will be evaluated in the same test set. The final super parameters that we used are as follows: Lr is \(10^{-5}\), max-depth is 12, and num-leaves is 20.