## 6 Proposed System Architecture and Components  
### Proposed System Architecture  
The proposed system consists of two main stages, which are the learning stage and the real-time stage. The main task of the learning stage is to build and update our proposed DMLRF algorithm. As demonstrated in Figure 5, the FDOT-D4 traffic historical dataset is divided into small parts based on available detectors. Each detector covers half a mile, so the highway is divided into half-mile segments. RFR algorithm is assigned for each segment, and each algorithm has six different hyper-parameters. The hyper-parameters are max depth, min sample split, min samples leaf, number of estimators, bootstrap sample, and max feature. A full description for each hyper parameter is available in Table 2. RSCV technique is utilized to determine the six hyper-parameter's values of each segment's model. Due to the variances of highway traffic flow data patterns in these segments, each RFR algorithm will be trained on different hyper-parameter values. By utilizing Stacking ensemble learning, all RFR models are used as inputs to build the DMLRF model. So, the DMLRF model will be built based on different hyper-parameters' values, which makes it a distributed machine learning model.  
In the real-time stage as illustrated in Figure 5, the Discretized Stream (DStream) of Apache Spark Streaming is utilized to process real-life traffic data records and store them as batches. The real-time stream records will be sent to the streaming layer of KA where Spark Streaming can process the real-life data and then use the saved DMLRF model to provide real-time traffic flow predictions. Prediction results will be sent to the serving layer of KA for analysis. In the serving layer, the system will calculate the Speed Reduction Index (SRI) value to determine a threshold value. The SRI formula returns values from 0 to 10 where 0 means very normal traffic flow and 10 means vehicles are not moving. 4 is the beginning of congestion, which is our threshold value. If the SRI value exceeds the threshold value, the system will calculate the delay time of traffic on each segment. A total delay time will be calculated for multiple complex segments located adjacent and between two exits in a highway to be shared with vehicles that are still out of the calculated area. The Internet of Vehicles communication schemes can be utilized to send and receive traffic beacon information (Average Seed, Total Volume, and Average Delay) between a cluster head and cluster nodes. Approaching vehicles will decide to either stay on the highway or use alternative roads based on the results. If the SRI value exceeds 9 for each segment, the total delay may exceed one hour and 30 min for some complex segment of the I-95 highway.  
\begin{table}
\begin{tabular}{l l} \hline \hline \multicolumn{1}{c}{**Hyper-Parameters**} & **Description** \\ \hline N estimators & Number of trees in the forest \\ \hline Max features & Max number of features considered for splitting a node \\ \hline Max depth & Max number of levels in each decision tree \\ \hline Min samples split & Min number of data points placed in a node before the node is split \\ \hline Min samples leaf & Min number of data points allowed in a leaf node \\ \hline Bootstrap & Method for sampling data points (with or without replacement) \\ \hline \hline \end{tabular}
\end{table}
Table 2: Random Forest hyper-parameters description.  
The SRI formula is presented in Equation (1). The results of the traffic flow predictions are transmitted and used to update the historical database, ensuring that the system remains consistently updated.  
\[SRI=1-(1-\frac{Average\;Predicted\;Speed}{Speed\;limit}\times 10) \tag{1}\]