# Ensemble Learning Traffic Model for Sofia: A Case Study
## 3 Materials and Methods  
We tackle the problem with the overwhelming amount of missing traffic data (in some cases more than 99.5%) by using a wide variety of features, grouped in several categories:  
* infrastructure including the street class, capacity, pavement, number of directions etc. * space syntax: integration and choice parameters with averaged distance
* functional analysis: points of interest and cadastral built-up area data modeled as concentration of activities and motorized users
* demographics: density of motorized inhabitants
* measured data: several traffic counts on primary and secondary streets and national roads, NO\({}_{2}\) levels. Some of the features we use are already a result of modeling, e.g., the Open Transport Map (OTM) traffic model, as well as interpolations of different results from previous studies. Table 1 describes briefly the different features we use as predictors in our model (cf [18; 19]). These are quite different types of data, as is their role in our model. The first few groups are categorical and we encode them as dummy variables. Together with the space syntax and demographic features they can be used for clustering of the data set which may improve the prediction accuracy significantly as we have seen in our previous studies. However, some of the clusters in this particular case end up with too few values to train and test the model, thus we only use the street type and distinguish between primary (type A) and secondary (type B) urban street network. Type A (7637 rows of data) consists of major traffic arteries, including city highways and bouleards, while type B (33,099 rows) includes secondary streets with much smaller traffic capacity. The geographic coordinates, which also play important role in our model, correspond to the centroids of the street segments described by each row in the data set. Naturally, the measurements of population density, activities, pollution etc. have not been conducted exactly in those points, so we use heat map and inverse distance weighted (IDW) interpolation or nearest joins to obtain a good estimate of those values in the corresponding row. As for the traffic count, as it is usually conducted at crossroads, we also need such techniques to evaluate it for street segments and hence to their centroids, by averaging. We rely on different sources for the different years--some provide an estimate for the daily or yearly average, others--time series for specific days of the year. We also conducted our own counts in certain points of the urban network, and estimated the corresponding daily average using the temporal dynamics \begin{table}
\begin{tabular}{l l r} \hline \hline
**Column Name** & **Data Content** & **Values** \\ \hline baseTYPE & street type classification & 40,736 \\ IMMIS\_RT & traffic situation typology & 7637 \\ C\_KAPAZ & estimated road capacity & 7637 \\ StrDANDRCT & number of directions & 40,736 \\ EMIT\_SPEED & speed limit & 7637 \\ EMIT\_GRDNT & street slope (gradient) & 7637 \\ SSINT\_In & space syntax (integration) & 40,736 \\ SSCH\_In & space syntax (choice) & 40,736 \\ XO, YO & coordinates of the centroids & 40,736 \\ OTMsurface & Open Transport Map (OTM) street surface type & 5710 \\ OTMtraffic & OTM traffic model & 7637 \\ TT200 mHMc & TomTom traffic count data heat map r = 200 m & 7637 \\ ACTUSEmean & heatmap r = 200 m estimated motorized users POI and cadastral data based & 40,651 \\ ACTLVmean & heatmap r = 200 m estimated motorized inhabitants census based & 40,497 \\ exLDWmean & IDW-interpolated point-based RF traffic model 1 & 7637 \\ \hline \hline \end{tabular} \({}^{\dagger}\) We used clusterization into segments according to traffic and consecutive data imputation with RF-regression.  
\end{table} 
Table 1: Features used for training the ML model. for the 'nearest' (with respect to the distance matrix) location, for which it is available. As might be expected, the model for the secondary streets feeds on much less features as less measurements are available for this neglected part of the urban infrastructure.