## 1 Introduction  
Transportation systems provide huge amounts of data that can be obtained from different resources in real-time such as sensors, detectors, smart cards, and video cameras [1, 2, 3]. By utilizing the big traffic data, researchers can discover the reasons for traffic accidents and congestion, redundant traffic jams in certain areas, traffic delay at intersections, and several redundant issues on transportation systems [4, 5, 6, 7, 8, 9, 10, 11]. However, the amount of traffic data increases rapidly to the level of Petabyte, which makes centralized machine learning prediction methods [12, 13] face a major drawback in terms of scalability limitation. Several big data techniques are utilized for processing and mining such as Artificial Intelligent tools, Machine Learning, and Data Mining [14]. Big data techniques are used in different fields of study, and researchers achieved outstanding results and success [15, 16, 17, 18]. Intransportation, decision makers should provide optimal solutions in real-time since vehicles are moving very fast. Apache Spark (3.x) and Hadoop (3.3.x) can process and store large amounts of data with a low computation time due to Hadoop Map-Reduce and Spark in-memory parallel distributed computing. These two big data platforms are used widely in industry and academia [19; 20]. Studying the redundant issues of the traffic flow in historical data, helps big data scientists to provide optimal traffic solutions for drivers [21; 22; 23; 24; 25; 26; 27; 28]. This research proposes a scalable real-time distributed machine learning-based scheme for Internet of Vehicles to predict highway traffic average speed, and detect abnormal traffic flow patterns. The proposed system consists of two main stages, which are the learning stage and the real-time stage. In the learning stage, a highway is divided into small complex segments and each Complex Segment (CS) consists of several segments. Each CS is located between two exits. We train and validate a local Random Forest Regression (RFR) model for each vehicle cluster (highway segment) using six different hyper-parameters: max depth, min sample split, min samples leaf, number of estimators, bootstrap sample, and max features. Randomize Search Cross Validation (RSCV) technique is utilized to determine the six hyper-parameters' values of each segment's model. By utilizing Stacking ensemble learning, all RFR models are used as inputs to build the Distributed Machine Learning Random Forest (DMLRF) model. Kappa Architecture (KA) is utilized to enable real-time traffic flow predictions [29]. The proposed system is implemented in Google Cloud Platform (GCP), which contains a private computing cluster with 17 nodes where 16 nodes were assigned as worker nodes (each highway's segment is assigned to one computing node) and one node will be the master node that controls the processing [30]. In the real-time stage, 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. This research utilizes real-life traffic data obtained from Florida Department of Transportation District 4 (FDOT-D4) [31]. The contribution of this study can be organized as follows:  
* Build a scalable distributed machine learning system that can predict highway traffic flows. The scheme divide a highway into small complex segments, where each complex segment is located between two exits to control the level of congestion and allow vehicles to exit the highway before entering the congestion zone. * Build a distributed machine learning model to improve the system performance for abnormal traffic flows. The distributed machine learning model is trained based on different hyper-parameters' values, where these values are determined based on the traffic flow patterns for each segment of the complex segment.