# A Vehicle Velocity Prediction Method with Kinematic Segment Recognition
## 4 Prediction and Analysis
### Parameter Setting and Training  
In order to obtain an accurate neural network vehicle velocity prediction model, the sub-LSTM neural network established should be able to accurately approximate the training samples. Therefore, in this section, the hyperparameters of the LSTM neural network were optimized by the QPSO algorithm to establish different sub-LSTM network models. Test samples were selected to verify the approximation degree of the LSTM prediction results,and the sub-LSTM neural network with the highest approximation degree was determined as the final vehicle velocity prediction model. When the training dataset was the first type of driving condition, the parameters of the QPSO algorithm were set as follows: the number of particles was 10, the number of populations was 100, the number of hidden layer neurons was [1, 200], the number of LSTM iterations was [1, 100], and the learning rate was [0.0001, 0.01]. The changes in particle fitness with the increase in iterations of the QPSO-LSTM 1 model are shown in Figure 6. The particle fitness finally stabilized at 0.006814. After QPSO optimization of the LSTM model hyperparameters, the final results are as shown in Figure 7 and Table 6, where the number of hidden layer neurons was \(L_{\text{a1}}=75\), \(L_{\text{b1}}=116\), the optimal iteration times of LSTM 1 was 90, and the optimal learning rate of LSTM 1 was 0.0094. The changes in particle fitness with the increase in iterations of the QPSO-LSTM 2 model are shown in Figure 8. The particle fitness finally stabilized at 0.002972. After QPSO optimization of the LSTM 2 model hyperparameters, the final results are as shown in Figure 9 and Table 6, where the number of hidden layer neurons was \(L_{\text{a1}}=61\), \(L_{\text{b1}}=80\), the optimal iteration times of LSTM 1 was 99, and the optimal learning rate of LSTM 1 was 0.00977. The changes in particle fitness with the increase in iterations of the QPSO-LSTM 3 model are shown in Figure 10. The particle fitness finally stabilized at 0.00321. After QPSO optimization of the LSTM 3 model hyperparameters, the final results are as shown in Figure 11 and Table 6, where the number of hidden layer neurons was \(L_{\text{a1}}=85\), \(L_{\text{b1}}=95\) \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Driving Condition** & **Prediction Method** & \(L_{\text{a1}}\) & \(L_{\text{b1}}\) & \(K_{\text{i}}\) & \(I_{\text{r1}}\) \\
**Type** & LSTM & 120 & 80 & 100 & 0.0035 \\ Type 1 & PSO-LSTM & 77 & 80 & 71 & 0.0079 \\  & QPSO-LSTM & 75 & 116 & 90 & 0.0094 \\ \hline  & LSTM & 100 & 80 & 100 & 0.005 \\ Type 2 & PSO-LSTM & 75 & 53 & 96 & 0.0096 \\  & QPSO-LSTM & 61 & 80 & 99 & 0.00977 \\ \hline  & LSTM & 90 & 60 & 100 & 0.0055 \\ Type 3 & PSO-LSTM & 100 & 134 & 94 & 0.0094 \\  & QPSO-LSTM & 85 & 95 & 92 & 0.0093 \\ \hline \hline \end{tabular} Note: \(i=1,2,3\).  
\end{table} 
Table 6: LSTM hyperparameters obtained by different optimization methods with a 2 s time horizon. Figure 8: The fitness curve of QPSO with iteration times for LSTM 2. Figure 9: The change in the QPSO hyperparameters with iteration times for LSTM 2. (**a**) \(L_{\text{a2}}\) changes with the number of iterations, (**b**) \(L_{\text{b2}}\) changes with the number of iterations, (**c**) \(K_{\text{2}}\) changes with the number of iterations, (**d**) \(I_{\text{r2}}\) changes with the number of iterations. the optimal iteration times of LSTM 3 was 92, and the optimal learning rate of LSTM 3 was 0.0093. In general, the LSTM super parameters are mostly based on experience to set up its hyperparameters, which are predicted by a single LSTM model and optimized LSTM model. One of the single LSTM models is to use each historical speed data as input, and then use the LSTM model to predict. This means that the hyperparameters in the LSTM prediction model are not necessarily optimal. Based on the optimized LSTM model, the LSTM, and the QPSO-LSTM, the optimized post-optimized hyperparameters were updated to the LSTM model.