# Response Prediction for Linear and Nonlinear Structures Based on Data-Driven Deep Learning
## 4 Results and Discussion  
### Response Prediction for the Linear Structure  
In this section, the trained RNN and LSTM models are used to predict the response of the linear system. The probability density function (PDF) \(P_{i}\) is used to analyze the error of the prediction results of the three cluster datasets in the test set. \(P_{i}\) is calculated as follows:  
\[P_{i}=PDF\Bigg{\{}\frac{(y_{i}-\widehat{y_{i}})}{\max\lvert(y_{1},y_{2},\ldots,y _{n})\rvert}\Bigg{\}} \tag{14}\]  
In order to further evaluate the prediction accuracy of the model, the weighted mean absolute percentage error (WMAPE) \(E_{\text{WMAPE}}\) and peak percentage error (PPE) \(E_{PEAK}\) were selected as evaluation indexes. The calculation formula is as follows:  
\[E_{WMAPE}=\frac{1}{m\times n}\sum_{j=1}^{m}\sum_{i=1}^{n}\frac{\left|y_{i}- \widehat{y_{i}}\right|}{\max\lvert(y_{1},y_{2},\ldots,y_{n})\rvert}\times 100\% \tag{15}\]  
\[E_{PEAK}=\left|\frac{y_{peak}-\widehat{y_{peak}}}{y_{peak}}\right|\times 100\% \tag{16}\]  
where \(y_{peak}\) is the true peak value of the time history response and \(\hat{y}_{peak}\) is the predicted peak value of the time history response. Figure 10 shows the error distribution of the prediction results by the RNN and LSTM models. As shown in Figure 10a, the errors of the result predicted by the RNN model were mainly distributed within the range of \(\pm 10\%\). Within this interval, the confidence degrees of the three clusters' prediction results were 99.9%, 93.9%, and 97.1%, respectively. As can be seen from Figure 10b, the prediction results of the LSTM model had similar  
Figure 9: Loss curves of RNN and LSTM models in the training process (for the nonlinear structure). (a) RNN model; (b) LSTM model. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Hyper Parameter** & **Value** & **Hyper Parameter** & **Value** \\ \hline Neurons in the hidden layer & 100 & Forgetting rate & 0.06 \\ Number of fully connected layer & 1 & Gradient threshold & 0.1 \\ Number of LSTM layers & 2 & Regularization & L2 Regularization \\ Number of iterations & 500 & Learning rate & 0.01 \\ Minimum batch size & 2 & Optimizer & Adam [39] \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Hyper parameters of the LSTM model for the nonlinear structure. probability distributions to the RNN model, and the errors were mainly concentrated in [-10%, 10%]. The corresponding confidence degrees were 99.5%, 92.4%, and 97.7%, respectively. The error values of the predicted structural response under seismic waves in cluster 1 were more concentrated around 0. In general, the errors of the linear structural response predicted by the RNN and LSTM models were within a reasonable range. There was no significant difference in the response prediction results of the linear structure system under different types of seismic waves. The results demonstrate that the two models had high generalization and prediction accuracy. Table 10 shows the error values \(E_{WMAPE}\) and \(E_{PEAK}\) of the results predicted by the RNN and LSTM models. \(E_{WMAPE}\) was used to describe the accuracy of all the predicted results. It can be seen that the \(E_{WMAPE}\) and \(E_{PEAK}\) of the predicted results of the displacement \(u\), velocity \(\dot{u}\), and acceleration \(\ddot{u}\) of different floors were all within 10%. According to the two indexes \(E_{WMAPE}\) and \(E_{WMAPE}\), the RNN model had a good prediction effect on the global displacement response and peak value of the acceleration response. The LSTM model could also predict the global acceleration response and peak value of the displacement response well. Figure 10: PDF of prediction results by RNN and LSTM models for linear systems. (**a**) RNN model; (**b**) LSTM model. Figure 11: Comparison of numerical results and prediction results (RNN model for linear systems; the third layer responds \([u_{i3},\dot{u}_{i3},\ddot{u}_{i3}]\)). (**a**) \(u_{i3}\) under the action of the seismic wave in cluster 1. (**b**) \(\dot{u}_{i3}\) under the action of the seismic wave in cluster 1.