# A Comparative Study of Ensemble Models for Predicting Road Traffic Congestion
## 5 Experimental Results and Discussion
### Models' Misclassification Cost  
Misclassification cost refers to all the penalties associated with errors during the classification process. The study aimed to determine the model that did not penalise commuters heavily in travel time and had sufficient information regarding traffic flow. All models were evaluated using the loss matrix shown in Table 6. The penalty was assigned based on the misclassification error for each model [55]. A penalty of 3 was assigned to a cell that predicted _Freeflow_ (c) when the actual traffic status was _Moderate or Bound flow_ (b) and _Congested_ (a). A penalty of 1 was assigned to a cell that predicted _Congested_ when the actual traffic status was _Moderate_. Then, a penalty of 0 was assigned to entries on the leading diagonal of the loss matrix, as the actual and the predicted vehicle status were the  
Figure 4: Results of the performance metrics (**a**) accuracy, (**b**) precision, (**c**) recall, and (**d**) fi-score for the different models. From the x-axis: Model 1—RF, Model 2—DT, Model 3—SVM, Model 4—Bagging (RF), Model 5—Bagging (DT), Model 6—Bagging (SVM), Model 7—AdaBoost (RF), Model 8—AdaBoost (DT), Model 9—AdaBoost (SVM), Model 10—Stacking (LR-RF, DT and SVM). same. Since there was a 3 \(\times\) 3 confusion matrix from the three classes (_Freeflow_, _Moderate_ or _Bound flow_, and _Congested_), a 3 \(\times\) 3 loss matrix was designed. The input in cells (Lkj) of Tables 7 and 8 specifies the penalty associated with the prediction of class Cj when in fact, it is Ck [55]. For all instances, X which belongs to Ck, the expected loss is given by Equation (5) below. Lkj is the penalty associated with misclassification for a predicted model. \[\mathrm{R_{k}}=\sum_{j=1}^{\mathrm{c}}\mathrm{L_{kj}}\int_{\mathrm{R}}^{ \prime}\mathrm{P(x|C_{k})}\ \mathrm{dx} \tag{5}\]  
\[\mathrm{R}=\sum_{k=1}^{\mathrm{c}}\mathrm{L_{kj}}\mathrm{P(x|\,C_{k})} \tag{6}\]  
The actual risk Equation (6) minimises each point x; i.e., when regions are chosen [55, 58]. Values of the loss matrix (for cells in Table 6) were chosen by hand, based on views of the knowledge expected in MTM. The misclassification cost of prediction was computed using Equation (7):  
\[\mathrm{C_{cost\_MLP}}=\mathrm{Conf_{kj}xL_{kj}}. \tag{7}\]  
\[\mathrm{Cost}\,=(0\times 929)+(1\times 8)+(2\times 1)+(3\times 2)+(0\times 3554)+( 1\times 1)+(3\times 0)+(1\times 7)+(0\times 2387)=24 \tag{8}\]  
\[\mathrm{Cost}\,=(0\times 42)+(1\times 896)+(2\times 0)+(3\times 0)+(0\times 3557)+( 1\times 0)+ \tag{9}\]  
\[(3\times 0)+(1\times 2394)+(0\times 0)=896+2394=3290\]  
The results were obtained when multiplying the values in Table 6 from the loss matrix with the corresponding cell values of a confusion matrix in Tables 7 and 8. The other eight prediction models in Table 5 were computed using their corresponding confusion \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & & \multicolumn{3}{c}{**Predicted**} \\ \hline \multirow{3}{*}{Actual} & & a & b & c \\ \cline{2-5}  & a & 0 & 1 & 2 \\ \cline{2-5}  & b & 3 & 0 & 1 \\ \cline{2-5}  & c & 3 & 1 & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Loss matrix for traffic congestion prediction. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & & \multicolumn{3}{c}{**Predicted**} \\ \hline \multirow{3}{*}{Actual} & & a & b & c \\ \cline{2-5}  & a & 929 & 8 & 1 \\ \cline{2-5}  & b & 2 & 3554 & 1 \\ \cline{2-5}  & c & 0 & 7 & 2387 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: The AdaBoost (DT) confusion matrix with a low misclassification rate. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & & \multicolumn{3}{c}{**Predicted**} \\ \hline \multirow{3}{*}{Actual} & & a & b & c \\ \cline{2-5}  & a & 42 & 896 & 0 \\ \cline{2-5}  & b & 0 & 3557 & 0 \\ \cline{2-5}  & c & 0 & 2394 & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: The AdaBoost (SVM) confusion matrix with a high misclassification rate. matrix. Table 7 showed that 929, 3554 and 2387 were classified correctly, with 19 incorrect classifications from the model development.