# Long Short-Term Memory Neural Network Applied to Train Dynamic Model and Speed Prediction
## 4 Experiment
### Results of \(n\) Steps Speed Prediction  
By employing the feature engineering, delicate descriptions of the raw features can be obtained. With the captured long-term pattern of the data and inspired by the studies on traffic speed prediction [41; 42; 43], we extended the LSTM based approach to predict train speed for multi-step \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Station Interval** & \(c_{0}\) & \(c_{1}\) & \(c_{2}\) \\ \hline
**Yancun Dong Station to Caoziwu Station** & 1.051400712 & 0.005980156 & 0.00022866 \\
**Caoziwu Station to Yancun Station** & 2.908890237 & 0.014551371 & 0.00002373932 \\
**Yancun Station to Xingcheng Station** & 1.078270769 & 0.005545171 & 0.0003830150 \\
**Xingcheng Station to Dashihe Dong Station** & 1.634758136 & 0.026648264 & 0.0000319240 \\
**Dashihe Dong Station to Magezhuang Station** & 1.051565386 & 0.020496939 & 0.0000288589 \\
**Magezhuang Station to Yaolefu Station** & 1.022215526 & 0.005227106 & 0.00002196136 \\
**Yaolefu Station to Fangshanchengguan Station** & 1.035460959 & 0.006413686 & 0.000698753 \\
**Fangshanchengguan Station to Yanshan Station** & 1.039279709 & 0.005581798 & 0.000388984 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Parameter settings of PTDM-II. Figure 6: Comparison of different approaches. ahead. With the help of the train speed prediction, the train running status can be obtained proactively. According to the predicted output, automatic train operation systems or drivers may take actions in advance to avoid or reduce damage resulting from system abnormalities. Taking the emergency braking distance and the sample interval into consideration, in the experiments, we predicted the 10-step ahead (\(10\times 0.2=2\) s), 30-step ahead (\(30\times 0.2=6\) s) and 50-step ahead (\(50\times 0.2=10\) s) train speeds. Table 7 provides the MAE and MSE with different prediction steps. By observing Table 7 and the tables in Section 4.1.1, one can find that the MAE and MSE values for multi-step ahead are significantly larger than the results of one-step ahead, i.e, the proposed dynamic model. As the prediction time step increases, the prediction accuracy of train speed deteriorates. For a long-term prediction (\(N=50\)), values of the MAE and MSE are 101.36 and 13,281.65, respectively. This can be understood by the fact that the increase of the prediction step may add more uncertainties, which leads to a reduction of the prediction performance. Taking 30-step-ahead prediction as an example, we draw the loss as a function of the epoch in Figure 7. Similar to Figure 4, the loss and the val-loss represent the values of the loss function in the training set and the validation set, respectively. The settings of the hyperparameters in Figure 7 and Table 7 are exactly the same as the settings in Section 4.1.2. It was observed that the loss oscillates at 0.023 and the val-loss converges to 0.039 after 70 epochs. To further examine the prediction performance in a more intuitive way, the comparisons between the original data and the output of 10-step-ahead prediction, 30-step-ahead prediction and 50-step-ahead prediction are shown in Figures 8-10, respectively. The algorithm output of 10-step-ahead prediction was observed to be relatively close to the original data. As the time step increases, the difference between the predicted value and the original data becomes larger, which is consistent with the results in Table 7. One can notice that the prediction accuracy degenerates after certain turning points. The reason is that the features extracted from the previous data may not describe the rapid change of the train speed. As can be seen in Figures 8-10, although the error increases in these scenarios, the proposed method has the ability to predict train speed since the prediction error is controlled to a legitimate range. The software program will be made available in the open code. One can found the link in the Supplementary Materials.