# Ensemble Learning Traffic Model for Sofia: A Case Study
## 4 Results
### The Primary Street Network  
Our strategy is to build up to the traffic model gradually, starting with data imputation for the features that are useful in the training process and cannot be reliably interpolated. Note that there are two different data rows for the average daily traffic in 2018 (the third one is a mix) as there are two sources of measurements. 'API18' shows clear signs of overfitting--the reason being not the selected algorithm but the data bias: all measurements have been done in strongly correlated segments from the major traffic arteries, near the city rings. Hence, we dismiss this prediction, as well as the one for the merged columns, considering it to be infested by this bias ('API16' has a similar problem). Other measurements cover only small time intervals and the corresponding daily averages have been evaluated using the temporal dynamics for the nearest (with respect to the origin-destination matrix) network vertex for which such data is available. All this naturally amounts to an error that is difficult to estimate. So, we have one type of data that is time-averaged but lacks sufficient spatial coverage ('API') and another one, much better put coordinate-wise while based on time-limited measurements ('DUAT'). The situation with nitrogen dioxide levels resembles the latter while 'SO22N' mixes different sources and is a compromise between the two. As our study is focused on spatial distribution, its natural target variables are 'DUAT18', 'SO22N' and 'NO2', while we treat other features merely as an aiding tool for the models. Table 2 above shows the accuracy of ensemble learning regression algorithms used for data imputation, while Figure 2 illustrates how our models perform on the primary street network when sufficient amount of training data is available and when that is not the case. Figure 1: Correlation heat map for the features and target variables used in the model. It is worth mentioning also the feature importance of different parameters. We show two examples in Figure 3. This marker shows how each feature affects the performance and accessing it allows us to understand the models better and improve them dynamically. Table 3 below demonstrates how AutoGluon ranks the best performing algorithms with respect to a chosen evaluation metric, in this case the coefficient of determination is r2. The values are obtained via cross validation and the ranking using MAE or MAPE is similar. The tables for all modeled features look quite alike. In some cases instead of AutoGluon we use the standard RF or XGB regressors and possibly fine parameter tuning with random search optimization, as shown in Table 2 as well as Table 4 in the next section. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Feature** & **Content** & **\% Missing** & **Model** & **Accuracy** & **r2** \\ \hline OTMcapicit & capacity & 25.23\% & XGB/RSO & 82.62\% & 0.83 \\ NM17\_1h & hourly 2017 & 93.70\% & WE\_L2 & 64.29\% & 0.94 \\  & traffic count & 99.21\% & WE\_L2 & 90.04\% & 0.74 \\ NO2 & NO2 levels & 99.21\% & XGB/RSO & 92.60\% & 0.91 \\ API16 & road traffic & 92.61\% & XGB/RSO & 92.60\% & 0.91 \\ DUAT180416 & street traffic & 60.05\% & WE\_L2 & 80.02\% & 0.43 \\ SO22N & street traffic & 99.36\% & WE\_L2 & 78.84\% & 0.33 \\ API18 & bidirectional & 99.63\% & WE\_L2 & 81.33\% & 0.97 \\ MIX18 & mixed traffic & 97.81\% & WE\_L2 & 71.68\% & 0.45 \\ DUAT18 & street traffic & 98.18\% & WE\_L2 & 67.95\% & 0.25 \\ \hline \hline \end{tabular}  
* Ranked by accuracy based on MAPE (mean absolute percentage error) estimates. We also use the abbreviations: RSO (Random Search Optimization), WE_L2 (Weighted Ensemble_L2), XGB (Extreme Gradient Boosting).  
\end{table} 
Table 2: Features with missing values predicted by the corresponding model 1.