# Comparative Analysis of Deep Learning Methods for Real-Time Estimation of Earthquake Magnitude
## 2 Data and Methods  
This paper uses the datasets from Japan's K-NET and KiK-net networks, covering earthquake records from ground stations from January 2008 to June 2021. The dataset contains 8144 seismic events and 297,099 sets of three-component acceleration records. The magnitude of the events ranges from 3.0 to 7.7 (the M\({}_{\text{JMA}}\) magnitude is used uniformly), the depth ranges from 0 to 300 km, the longitude of the epicenter ranges from 122.267 E to 148.84 E, and the latitude of the epicenter ranges from 23.320 N to 45.985 N (Figure 1). The sampling frequency of the records from the stations is 100 Hz and the distance between the epicenters ranges from 0.11 to 299.88 km. A signal-to-noise ratio (S/N ratio) exceeding ten was selected to ensure the data quality. In order to ensure the data quality, events with a signal-to-noise ratio of more than ten and with more than five sets of three-component acceleration waveforms were selected. The data were processed in the following steps: 1 P-wave arrival pickup: using the vertical acceleration records, the P-wave arrivals were picked up automatically based on the long- and short-term averaging method and the Akaike information criterion, and the results were subsequently corrected manually. 2 Baseline correction: the records were checked, and baseline correction was performed by subtracting the average value of the records from the first 2 s of the P-wave arrival. 3 Filtering process: a fourth-order Butterworth high-pass recursive filter was used for processing, with the cutoff band set to 0.075 Hz to remove low-frequency noise [20]. 4 Dataset division (Figure 2): The dataset was divided into a training set (5365 earthquakes), a validation set (728 earthquakes), and a test set (2051 earthquakes) according to the moment of epicenter generation to ensure that the proportion of magnitude in each dataset was appropriate. The epicenter distance directly affects the propagation characteristics of seismic waves, including amplitude attenuation, frequency variation, and waveform differences. Seismic records from different epicenter distances exhibit significant characteristic differences. Therefore, segmenting the dataset according to epicenter distance can ensure that samples within each sub-dataset have similar feature distributions, thereby reducing noise caused by differences in epicenter distance and improving data comparability and model prediction accuracy. After the above processing, the model inputs were waveforms of fixed length (20 s) and the arrivals were simulated for real-time monitoring. This study combines the advantages of convolutional neural networks (CNNs) [21] and bidirectional long- and short-term memory networks (Bi-LSTMs) to optimize the efficiency and accuracy of seismic waveform analysis. 1. MagNet [17] ([[https://github.com/smousavi05/MagNet](https://github.com/smousavi05/MagNet)]([https://github.com/smousavi05/MagNet](https://github.com/smousavi05/MagNet)), accessed on 13 February 2025) uses two one-dimensional convolutional layers (CNN1D) for feature extraction, with each encoder consisting of two CNN1D layers backed up by MaxPool1D for dimensionality reduction. The model extracts temporal dependencies through a bidirectional LSTM layer. The model effectively captures the relationship between the magnitude and P-wave arrival time. Figure 1: Distribution of earthquake epicenters and station locations in the K-NET and KiK-net networks in Japan. Figure 2: Distribution of the amount of data with magnitude for the training set (E), validation set (V), and test set (T). 2. DCRNN adds three encoders to MagNet and the convolutional kernel size is gradually reduced to expand the sensory field for feature extraction. A multilayer perceptron (MLP) converts the feature output from the Bi-LSTM into magnitude estimations. 3. DCRNNAmp adds a layer on top of DCRNN to take the maximum value of various input data as global information, which enhances the accuracy of the model estimation by splicing it with the Bi-LSTM output feature vectors. 4.