# Research on the Classification of ECG and PCG Signals Based on BiLSTM-GoogLeNet-DS
## 3 Related Theory  
### BiLSTM  
LSTM (long short-term memory network), which has the advantage of memorability, is an improved model of the recurrent neural network. It can efficiently learn the nonlinear characteristics of the time series. In the internal structure of LSTM, the activation method of the nodes in the hidden layer is very complex. By selectively remembering, forgetting information with relatively small effects, and remembering useful information with relatively large time intervals, it solves the problem of gradient explosion and gradient disappearance of a long time series. The memory unit of LSTM consists of three gate structures: input gate, forget gate and output gate. The network structure is shown in Figure 2. These gates ensure that information can be selectively passed, and the state of the transmission unit can be obtained by some linear operations, so as to ensure the invariance of information during transmission. By memorizing the information selectively, it can ensure that most of the sample data are effectively used. Its deep features can be learned to diagnose diseases. Figure 1: Classification method and implementation process of ECG and PCG signals. In LSTM, the sample data will go through the following three stages: the forgetting gate, deciding which information to forget, and which information to retain. Through the input gate, the cell state is updated and the updated information is determined. Through the output gate, the output information is obtained. The current sample input \(x_{t}\) and the previous sequence output \(h_{t-1}\) jointly determine the cell state \(c_{t-1}\) of which information needs to be remembered. \[f_{t}=\sigma(W_{f}\cdot(h_{t-1},x_{t})+b_{f}) \tag{1}\]  
In the following formula: \(W_{f}\) is the weight. \(b_{f}\) is offset. \(\sigma\) is the sigmoid activation function. \(C_{t-1}\) represents the cell state, which is used to save the information of the previous memory moment. \(f_{t}\) represents the forgetting degree of the forgetting gate to the cell state. The input gate updates the cell state and determines the new information to be added to the cell state. \[i_{t}=\sigma(W_{i}\cdot(h_{t-1},x_{t})+b_{c}) \tag{2}\]  
\[\widetilde{C}_{t}=\tanh(W_{c}\cdot(h_{t-1},x_{t})+b_{c}) \tag{3}\]  
\[C_{t}=f_{t}\cdot C_{t-1}+i_{t}\cdot\widetilde{C}_{t} \tag{4}\]  
In the following formula: \(i_{t}\) represents the update degree of the input gate to the new information; \(\widetilde{C}_{t}\) is the candidate vector of the current new state information; then the cell state is updated, \(f_{t}\cdot C_{t-1}\) represents the information to be forgotten; \(i_{t}\cdot\widetilde{C}_{t}\) represents the information to be retained; \(C_{t}\) represents the current cell state. In this way, the information is stored in the memory unit, and finally the information is output at the output gate. \[o_{t}=\sigma(W_{o}\cdot(h_{t-1},x_{t})+b_{o}) \tag{5}\]  
\[h_{t}=o_{t}\cdot\tanh(C_{t}) \tag{6}\]  
In the following formula: \(o_{t}\) represents the output information of the output gate; \(h_{t}\) is the output of the hidden layer. At the same time, the output \(h_{t}\) will also be fed into the next LSTM unit. Sigmoid function:  
\[\sigma(x)=(1+e^{-x})^{-1} \tag{7}\]  
Figure 2: Network structure of LSTM. Tanh function:  
Figure 1:0  
Although the LSTM neural network has a memory function and can learn historical information, it can only learn forward information and cannot make effective use of backward information. The BiLSTM network model is the improvement of LSTM. It can make up for the shortcomings of the above LSTM, and its learning ability has further improved compared to LSTM. The BiLSTM structure is shown in Figure 1:1 The BiLSTM network has two-direction transmission layers, a forward-transmission layer, and a back-transmission layer. The forward-transmission layer trains the time series forward, the back-transmission layer trains the time series backward, and both the forward-transmission and back-transmission layers are connected to the output layer.