# Concrete Dam Deformation Prediction Model Research Based on SSA-LSTM
## 2 LSTM and SSA Fundamentals  
### LSTM Principles  
Most of the monitoring data generated during the operation of hydraulic buildings are structured time series data. The LSTM model is an improved recurrent neural network (RNN) model with special units (i.e., memory modules) added to the RNN, which is compatible with processing time series data of dams [20; 21; 22]. While learning the current information, the LSTM model also extracts the correlation of data with large span on the time series, so as to reduce the rate of information loss and achieve lasting memory. Its effective use in dam safety monitoring and good performance in longer time series data prediction has been verified through long-term research. As shown in Figure 1, the LSTM model structure consists of a forget gate (\(f_{t}^{\dagger}\)), input gate (\(i_{t}^{\dagger}\)), and output gate (\(o_{t}^{\dagger}\)), and the decision to update or discard data is made through these three components. First, the forgetting gate decides with a certain probability whether to retain the state of the cell at the previous moment and selects the proportion of the information to be retained by utilizing the output (\(h_{t}-1\)) of the hidden layer from the previous time step and the input (\(x_{t}\)) at the current time step, and the two parameters are fed into the sigmoid activation function (\(\sigma\)) to obtain the output of the forgetting gate (\(f_{t}\)). \(f_{t}\) and \(\sigma\) are calculated as:  
\[f_{t}=\sigma\Big{(}W_{f}\cdot(h_{t-1},x_{i})+b_{f}\Big{)} \tag{1}\]  
\[\sigma(x)=1/\big{(}1-e^{-x}\big{)} \tag{2}\]  
where \(W_{f}\) is weight matrixes of the forget gate, \(b_{f}\) is deviation vectors, and \(\sigma\) is the logistic sigmoidal function. The input vector at time \(t\) and the output vector at time \(t-1\)\(h_{t-1}\) are represented by \(x_{i}\) and \(h_{t-1}\), respectively. The forget gate output \(f_{t}\) regulates the extent to which the unit information from the previous time step is forgotten, and its values are bound within the range of [0, 1]. \(f_{t}=1\) means complete retention and \(f_{t}=0\) complete forgetting. The role of the input gate is to filter the input at the current moment to determine which information needs to be stored as new information in the cell state. The introduction of new information is determined by both the sigmoid layer (\(\sigma\)) and the tanh layer (\(\tanh\)), where the sigmoid layer (\(\sigma\)) determines the degree of new information entry it and the tanh layer (\(\tanh\)) generates the amount of new information candidates \(\bar{a}_{t}\) at needed for storage. The relevant calculation formula is:  
\[i_{t}=\sigma(W_{i}\cdot(h_{t-1},x_{i})+b_{i}) \tag{3}\]  
\[\bar{a}_{t}=\tanh(W_{c}\cdot(h_{t-1},x_{i})+b_{c}) \tag{4}\]  
\[\tanh x=\big{(}1-e^{-x}\big{)}/\big{(}1+e^{-x}\big{)} \tag{5}\]where \(W_{i}\), \(W_{c}\) are weight matrixes of sigmoid layer and tanh layer, respectively, and \(b_{i}\), \(b_{c}\) are deviation vectors of sigmoid layer and tanh layer, respectively. The cell state is updated by combining the previous time step's cell state and the current time step's input information through the forgetting and input gates. The new cell status update formula is:  
\[C_{t}=f_{t}C_{t-1}+i_{t}a_{t} \tag{6}\]  
The output gate selectively extracts relevant information from the current cell state to generate a new hidden layer. The output part of the current cell state is first determined by the sigmoid function (\(\sigma\)), then the current cell state is processed by the tanh function (tanh), and finally a new hidden layer \(h_{t}\) is generated. The relevant calculation formula is:  
\[h_{t}=o_{t}\tanh\ C_{t} \tag{7}\]  
\[o_{t}=\sigma(W_{o}\cdot(h_{t-1},x_{i})+b_{o}) \tag{8}\]  
where \(W_{o}\) is weight matrixes of the output gate, and \(b_{f}\) is deviation vectors.