## 3 Methods
### Evaluation Metrics  
It is generally considered that a forecast is accurate if the predicted magnitude is within _Ms_\(\pm\)0.5 of the actual magnitude. If the predicted magnitude is more than _Ms_ +0.5 above the actual magnitude, it is defined as a false alarm. If the predicted magnitude is more than _Ms_ \(-\)0.5 below the actual magnitude, it is defined as a missed alarm [43]. This paper mainly studies the prediction effects for magnitudes _Ms_ 5.0-6.0 and above _Ms_ 6.0. Therefore, when treating this as a regression problem, the actual magnitude range needs to be predefined. Hence, the PA, FAR, and MR in this paper are calculated under the premise that the actual magnitudes are between _Ms_ 5.0 and 6.0 and above _Ms_ 6.0. Suppose we are calculating the metrics for earthquakes with actual magnitudes greater than or equal to _Ms_ 5.0 but less than _Ms_ 6.0. Let N represent the total number of samples with actual magnitudes between _Ms_ 5.0 and 6.0, A represent the number of samples where the predicted magnitude is within _Ms_\(\pm\)0.5 of the actual magnitude, F represent the number of samples where the predicted magnitude is more than _Ms_ +0.5 from the actual magnitude, and M represent the number of samples where the predicted magnitude is more than _Ms_ \(-\)0.5 from the actual magnitude. The metrics are defined as follows:  
PA: The proportion of samples where the predicted magnitude is within \(\pm\)0.5 of the actual magnitude to the total number of samples. The calculation formula is as follows:  
\[PA=\frac{A}{N} \tag{27}\]  
FAR: The proportion of samples where the actual magnitude is between _Ms_ 5.0 and 6.0 but the predicted magnitude is more than +0.5 from the actual magnitude to the total number of samples. The calculation formula is as follows:  
\[FAR=\frac{F}{N} \tag{28}\]  
Figure 8: ATT-BiLSTM processing steps.  
Figure 7: ATT-LSTM processing steps.  
MR: The proportion of samples where the actual magnitude is between \(Ms\) 5.0 and 6.0 but the predicted magnitude is more than \(-0.5\) from the actual magnitude to the total number of samples. The calculation formula is as follows:  
\[MR=\frac{M}{N} \tag{29}\]  
Additionally, we calculated the MSE, Root Mean Squared Error (RMSE), and Mean Absolute Error (MAE) of the test set when treating this as a regression problem. The specific definitions and calculation formulas are as follows:  
MSE is a common metric for measuring the difference between predicted values and actual values. MSE is the average of the squared differences between the predicted and actual values and is used to quantify the overall deviation of the prediction results. The formula is as follows:  
\[MSE=\frac{1}{n}{\sum_{i=1}^{n}}(y_{i}-\hat{y}_{i})^{2} \tag{30}\]  
where \(y_{i}\) is the \(i\)-th actual value, \(\hat{y}_{i}\) is the \(i\)-th predicted value, and \(n\) is the total number of samples. The smaller the MSE value, the better the predictive performance of the model. Due to the squared error, MSE is more sensitive to outliers.  
RMSE is the square root of MSE. Similar to MSE, RMSE is a metric for measuring the difference between predicted values and actual values. However, RMSE has the same unit as the original data, which makes it more interpretable. The formula is as follows:  
\[RMSE=\sqrt{MSE}=\sqrt{\frac{1}{n}{\sum_{i=1}^{n}}(y_{i}-\hat{y}_{i})^{2}} \tag{31}\]  
The smaller the RMSE, the better the predictive performance of the model. Like MSE, RMSE is also sensitive to outliers.  
MAE is the average of the absolute values of the errors. It is another metric for measuring the difference between predicted values and actual values. The formula for calculating MAE is as follows:  
\[MAE=\frac{1}{n}{\sum_{i=1}^{n}}\mid y_{i}-\hat{y}_{i}\mid \tag{32}\]  
MAE reflects the average magnitude of the errors without considering their direction, making it less sensitive to outliers compared to MSE and RMSE. The smaller the MAE, the better the predictive performance of the model. But it does not weight the size of the errors.