# Long Short-Term Memory Neural Network Applied to Train Dynamic Model and Speed Prediction
## 4 Experiment
### The Proposed Train Dynamic Model
#### 4.1.2 Comparison with Parametric Based Train Dynamic Model  
Using the best hyperparameter settings, i.e., \(\text{hidden size}=18\), \(\text{batch size}=128\) and learning rate \(=0.002\), we draw the loss as a function of the epoch. In Figure 4, the loss and the val-loss represent the values of the loss function in the training set and the validation set, respectively. As can be seen in Figure 4, our proposed approach has a fast convergence performance and a high degree of accuracy. More clearly, after 10 epochs, the loss and the val-loss converge to 0.0038 and 0.0052, respectively. One can found that there is a difference in the magnitude of the MAE in Figure 4 and tables in Section 4.1.1. The reason for this situation is the use of the Min-Max Normalization. To be more specific, the features were scaled before being fed into the proposed algorithm. The MAEs in Figure 4 were calculated according to the normalized data. In the experiment, the features were scaled to lie between zero and one, resulting in small values of the MAE. It should be noted that, when the training process was finished, the predicted values were transformed inversely to the original range to compare to the actual values. The MAEs shown in the tables in Section 4.1.1 were calculated after the reverse process. Thus, relatively large values were obtained. Intuitively, Figure 5 shows the comparison of the output of the proposed train dynamic model and the original data. The raw features, i.e., \(\text{analog output}_{t-1}\), \(\text{traction brake}_{t-1}\), \(\text{train speed}_{t-1}\) and \(\text{slope}_{t-1}\), were directly fed into the proposed model to get the the train speed of the next time step. Thus, it can be considered as predicting train speed for one-step ahead. As can be seen in Figure 5, no matter how the operation process changes (such as train accelerating and train braking), the output of the proposed approach is particularly close to the original data. To further verify the effectiveness of the proposed train dynamic model, we also made a comparison with another two parametric approaches: (i) a parametric train dynamic model that is currently being used in real train control systems (PTDM-I); and (ii) a parametric approach that the parameters have been optimized using the fruit fly optimization algorithm (PTDM-II). Note that these two approaches follow the single-point train dynamic model as described in Section 3.1. The PTDM-I relies on a simple method of table lookups to produce the speed of the next time step. The corresponding relationship between the velocity (km/h) and the acceleration (m/s\({}^{2}\)) of PTDM-I is shown in Table 5. PTDM-II uses the fruit fly optimization algorithm to optimize the resistance parameters of the Davis formula, i.e., \(c_{0}\), \(c_{1}\) and \(c_{2}\), as shown in Equation (2). The settings of these parameters for Yanfang Metro Line are listed in Table 6. \begin{table}
\begin{tabular}{c c c} \hline \hline
**(a) Performance Comparison with Different Learning Rates.** \\ \hline
**Learning Rate** & **MSE** & **MAE** \\ \hline
0.0001 & 8940.12 & 114.69 \\
0.0005 & 518.34 & 18.18 \\
0.001 & 403.57 & 15.99 \\
**0.002** & **122.93** & **9.28** \\
0.005 & 491.82 & 17.29 \\
0.01 & 2035.62 & 40.39 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Influence of the learning rate and the number of layers. Figure 4: Comparison of the loss in the training results. Figure 5: Comparison of the original data and the output of the proposed model.