## 3 Earthquake Prediction Models
### The Deep Neural Network Model
These two parameters enable the model to have greater expressiveness and learn richer features from the input data. * LSTM Layer. We employed a long short-term memory (LSTM) network to capture the long-term and short-term temporal dependencies in the earthquake signal data. LSTM is a special type of recurrent neural network (RNN) that addresses the vanishing and exploding gradient problems that traditional RNN may encounter when processing long sequences by using gating units. This makes LSTM more suitable for handling data with complex temporal dependencies, such as earthquake signals. In this model, we used an LSTM layer with 128 neurons to fully extract the temporal information in the input data. To further process the temporal features in subsequent layers, we set the return-sequences = True parameter, allowing the LSTM layer to output a sequence with the same length as the input. In this way, the LSTM layer can capture not only short-term fluctuations in the earthquake signal but also long-term trends in the earthquake sequence. By combining the LSTM layer and subsequent convolutional layers, our model can better capture and understand the dynamic characteristics of earthquake signal data, providing a more accurate and reliable basis for earthquake prediction. * 1D-CNN Branch. After the LSTM layer, we constructed a subnetwork containing two 1D convolutional layers to extract local features from the earthquake signal. The first 1D convolutional layer has 128 convolution kernels, a kernel size of 2, and uses the ReLU activation function. The second 1D convolutional layer has 256 convolution kernels, a kernel size of 2, and also uses the ReLU activation function. Next, we employed a Gaussian dropout layer to prevent overfitting, and flattened the result for subsequent processing. Flattening is a data preprocessing operation in neural networks used to convert a multi-dimensional tensor into a one-dimensional tensor. This operation is very common in convolutional neural networks (CNN) because the feature maps usually have a multi-dimensional structure after multiple layers of convolution and pooling operations. In order to connect these feature maps to subsequent fully connected layers for further processing, we need to flatten them into a one-dimensional vector. Specifically, the operation of the flatten layer can be expressed with the following formula: \[Y_{i}=x[a_{1},a_{2},\dots,a_{n}]\] (5)  
In the formula, \(x\) is the input multi-dimensional tensor with a shape of \((d_{1},\dots,d_{n})\); \(Y\) is the output one-dimensional tensor with a shape of \(m\), where \(m=d_{1}{}^{*}d_{2}{}^{*}\dots{}^{*}d_{n}\); \(i\) is the element index in the output vector \(Y\), with a range of \([0,\,m-1]\); \(a_{1},a_{2},\dots,a_{n}\) are the element indices in the input tensor \(x\), with respective ranges of \([0,\,d_{1}-1]\), \([0,\,d_{2}-1]\), \(\dots,[0,\,d_{n}-1]\); for each \(i\). We can find a unique set of indices \(a_{1},a_{2},\dots,a_{n}\) such that \(Y_{i}\) corresponds to \(x[a_{1},a_{2},\dots,a_{n}]\). This process essentially involves traversing all elements of the input tensor \(x\) in a specific order (usually row-major or column-major) and copying them one-by-one into the output vector \(Y\). * 2D-CNN Branch. It is worth noting that after the input layer, we constructed a subnetwork consisting of a fully connected layer and multiple 2D convolutional layers. First, the data were reshaped into a tensor with a shape of (16, 16, 1). Next, we built two 2D convolutional layers with different kernel sizes, and then concatenated the outputs of the two 2D convolutional layers. Finally, the result was flattened for subsequent processing. 2D-CNN have certain advantages when processing time-series data, as they can capture local features in both the time and frequency domains simultaneously. Specifically, 2D-CNN can identify specific patterns at different times and frequencies, revealing spatial (time-domain) and frequency features in the signal.