# Unsupervised Driving Situation Detection in Latent Space for Autonomous Cars
## 5 Experiments
### Global Driving Policy vs. Driving Situation Policies  
The experiment consists of comparing the performance of dividing the problem into driving policies automatically versus a global driving policy, as in the case of end-to-end systems. To accomplish this, we use the complete dataset of 14,540 examples to make the global driving policy learn. The data are divided into 90 percent for training and 10 percent for validation, while, to obtain the automatic policies, the data will be divided as in the proposed methodology. Once both are trained, we will compare the obtained results using the R2 score metric. First, a Neural Network was trained to have as input the representation in the latent space of the image of the car state, and as output the prediction of the vector of actions that should be applied in order to have a driving policy. Individual Neural Networks were trained according to the driving situations, and the data were divided according to the clustering of driving situations presented previously. The input normalization is important in most learning algorithms. Since different features might have totally different scales, we use min-max normalization. \begin{table}
\begin{tabular}{c c} \hline \hline
**Situation** & **Number of Examples** \\ \hline Situation 1 & 2863 \\ Situation 2 & 3097 \\ Situation 3 & 1918 \\ Situation 4 & 1767 \\ Situation 5 & 1279 \\ Situation 6 & 1367 \\ Situation 7 & 2250 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Dataset division according to each driving situation. Figure 9: Two-dimensional representation of the embedding using t-SNE and color according to each situation. The number assigned to each color corresponds to the driving situation. The architectures for the end-to-end system and for the individual situation policies are the same in order to compare the obtained results. In Table 5, you can see the hyperparameters of the Neural Networks. It is worth mentioning that no one has used our data for autonomous driving in the state-of-the-art literature. To compare our method with the state-of-the-art methods, we reproduce two different architectures and we train them with our data. The architectures PilotNet and AutoPilot are based on the paper presented by Nvidia [36]. The results are presented in Table 6. To train these methods, we use the following hyperparameters: activation function: ReLU; Optimizer: Adam; Loss Function: MSE; Epochs = 100; and learning rate = 0.001. In order to compare the results of the control predictions of the neural networks, the coefficient of determination was used, which tells us how good a regression model is according to the proportion of variability explained by the fitted model [37]:  
\[R^{2}=1-\frac{SSE}{SST} \tag{14}\]  
where: \(R^{2}\) is the coefficient of determination; \(SSE\) is the error sum of squares:  
\[SSE=\sum_{i=1}^{n}(y_{i}-\hat{y}_{i})^{2}; \tag{15}\]  
\(SST\) is the total corrected sum of squares:  
\[SST=\sum_{i=1}^{n}(y_{i}-\bar{y}_{i})^{2}. \tag{16}\]  
Policies Training  
Experimental results show that with a fixed number of iterations, this approach achieves better performance compared with an end-to-end system and can converge faster. The calculated \(R^{2}\) score corresponds to the mean of the five elements of the output vector, which means that every value of the output vector was compared with the ground truth value. Afterwards, the \(R^{2}\) score is averaged to obtain a single value of this metric. In Figure 10, we can see an example of the behavior of the curve during the training of the neural network for a single driving policy. In Table 6, we can see the result of the end-to-end system, and in Table 7, we can see the results for each individual driving policy. The mean of \(R^{2}\) Score of all the driving policies was 0.53147, which is higher than the 0.3362 obtained from the end-to-end system. For this reason, it is better to divide a global policy into small ones. The individual policies present a better \(R^{2}\) score, which determines that it learns better.