<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Traffic Flow Prediction Using Uber Movement Data</title></titleStmt>
			<publicationStmt>
				<publisher>Springer</publisher>
				<date>07/19/2024</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10557103</idno>
					<idno type="doi"></idno>
					
					<author>D Cenni</author><author>Q Han</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[The smart city paradigm is closely related to the orderly and sustainable use of the services it provides, on the efficiency of interconnections and communications that take place in an urban context. In this regard, one of the biggest challenges for smart city development relates to the prediction of traffic conditions. In fact, the city's road system has a decisive impact on air pollution, the management of public events, and in general on the efficiency of services offered to people, and thus strongly affects the city's economic development. In recent years, the development of increasingly effective machine learning and deep learning techniques has made a significant contribution to the definition of predictive models in the smart city domain. Deep learning techniques provide efficient results, but need significant computational resources to deal with huge and constantly updating datasets. Very often, however, the traffic data provided by cities are incomplete and insufficient to implement effective deep-learning models. In this paper, a novel solution for defining predictive models of traffic conditions is presented, based on road segmentation and urban traffic-related data, with the aim of dealing with the inherent complexity of geographical datasets. The obtained model has an average accuracy of 94.8%. The proposed architecture is able to reduce the inherent complexity of traffic related data, is easily scalable, can be quickly applied to any urban context.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1">Introduction</head><p>Traffic congestion refers to an excess of vehicles on a portion of the roadway at a particular time, resulting in speeds that are lower than normal (or free flow ) speeds. Analyzing the primary causes of traffic congestion, we find that it depends on seven factors that often condition on each other, which can be divided into traffic incidents, work zones, weather; fluctuations in normal traffic, special events; physical road features, traffic control devices, physical bottlenecks.</p><p>The rapid emergence of deep learning techniques has enabled the definition of increasingly sophisticated models for traffic prediction, and numerous services have been proposed in this regard. Commercial providers of traffic-related services include Google Maps Platform, Waze, TomTom's Traffic RESTful APIs, HERE Real-Time Traffic, ArcGIS Traffic Service REST APIs, and PTV Traffic Data. Google Maps analyzes historical traffic patterns for roads over time, but do not provide direct traffic forecasts for specific time horizons in terms of congestion metrics <ref type="bibr">[1]</ref>. Waze collects information on traffic, accidents, and jams from its users every 2 minutes, which can be accessed via XML, JSON and Geo RSS data feeds <ref type="bibr">[2]</ref>. However, this information is only useful if there is a sufficient number of vehicles in the area of interest, and traffic predictions are not provided. TomTom provides access to historical and real-time traffic incidents and traffic flow data that is updated every 30 seconds and provides predictions up to 24-hours ahead. HERE collects data every minute from various incident monitoring services and provides predictions for the next 12 hours, based on historical and real-time data <ref type="bibr">[3]</ref>. ArcGIS allows visualization of traffic conditions that is updated every 5 minutes and provides traffic predictions for the next 4 hours shown in web maps <ref type="bibr">[4]</ref>. PTV provides short-term traffic predictions, up to 60 minutes <ref type="bibr">[5]</ref>. Each of these solutions has some advantages, but none can provide real-time traffic predictions with different time horizons, and more specifically they do not provide predictions with medium to long time horizons. In order to build efficient predictive models that can generalize well to any geographic scale with highly detailed time resolutions, it is necessary to deal with large amounts of data and the issues that come with it (e.g., noise from spurious data, data imputation, data reconciliation, use of data from different sources with different time resolutions).</p><p>This paper presents an effective solution for dealing with huge amounts of traffic data, to overcome all the above-mentioned issues, with the aim of providing fast and reliable traffic predictions at large geographical scales. Section 2 discusses the main techniques implemented for solving the traffic prediction task. Section 3 introduces the dataset used for this study, and various pre-processing strategies implemented to mitigate the complexity of the problem, clean the data, speed up the training time, and build a scalable solution. Section 4 describes the proposed model's architecture and setup. Section 5 describes the experiments and the obtained results, with relevant performance metrics. Section 6 describes a web application implemented to visualize traffic predictions in an easy and usable manner. Section 7 reports the conclusions with a sketch of future development.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2">Related Work</head><p>Traffic prediction is a problem that has benefited greatly from the introduction of low-cost deep-learning techniques. Generally, traffic prediction models are based on classical or deep learning methods. Classical methods include statistical methods and traditional machine learning methods, while deep learning methods include CNN, RNN, GCN, and attention mechanism. Some approaches make use of graph neural networks (GNNs) to model spatial dependencies, or recurrent neural networks (RNNs) to capture temporal dependencies. However, in general RNNs are not effective tools in the case of temporal sequences, as they cannot capture their sequentiality, but are capable of modeling the periodicity and seasonality of the series. GNNs have limitations in terms of traffic prediction, since they model spatial dependencies statically, and thus have a limited capacity to learn dynamic traffic patterns. Often, they only consider short-range spatial dependencies and cannot capture long-range ones. In general, GNNs do not consider that traffic conditions propagate with a time delay between locations. To overcome some of these problems a novel Propagation Delay-aware dynamic long-range transformer was proposed, for accurate traffic flow prediction, designed with a self-attention module to capture the dynamic spatial dependencies <ref type="bibr">[6]</ref>.</p><p>Since the spatial dependence is usually treated as a static graph, a Dynamical Spatial-Temporal Graph Neural Network model (DSTGNN), creating a spatial dependence graph based on the stability of node's spatial dependence, to capture the dynamical relationship. The changing demand process is modeled using a Poisson process to address the interpretability and build a spatial-temporal embedding network (integrating the diffusion convolution neural network and a modified transformer) that can infer the intensity <ref type="bibr">[7]</ref>. Other algorithms often used for traffic prediction are Historical Average (HA), Auto-Regressive Integrated Moving Average (ARIMA), and Vector AutoRegressive (VAR). However, these techniques are only applicable to datasets of small size, while time-varying traffic data is huge. In order to avoid the problem of dealing with high dimensionality and to capture complex nonlinear relationships, other approaches such as Support Vector Regression (SVR) <ref type="bibr">[8]</ref> and Random Forest Regression <ref type="bibr">[9]</ref> have been proposed. Using geospatial dependencies introduces high complexity into the model, which makes it difficult to scale. State-of-the-art solutions for processing geospatial dependencies require not inconsiderable computational resources and, despite the application of distributed computing techniques (e.g., Dask and multi-GPU multi-node architectures), do not allow the training phase of the model to scale effectively. Our solution consists of a platform for processing geospatial data, which aims to reduce their complexity, so that models can be built to perform the learning phase in reasonable time, and accurate predictions, enabling the big data domain in the field of traffic data.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">Data and Architecture</head><p>With the aim of avoiding the use of complex datasets that do not provide data over time and that require using metrics that are not easily measured, we chose to model traffic intensity using the average speed of vehicles in each road segment. A road segment (osm way id in the OpenStreetMap's notation) is the specific representation of a road's portion with uniform characteristics. Vehicle speed, being a direct metric for measuring traffic intensity, is representative when calculated as an average value over a given time interval. For this reason, traffic related data used in this study were retrieved from Uber Movement, (c) 2023 Uber Technologies, Inc. <ref type="bibr">[10]</ref>, for the city of San Francisco, US. Uber provides hourly time series data with historical speeds (mph), for various cities, and travel times, and allows for a detailed dataset to produce traffic predictions with high spatial resolution. This dataset provides the average hourly speed on a given road segment for each day of January 2019, including only road segments with at least 5 unique trips in that hour. Preliminarily a osm file for the region of interest was retrieved with the aim of OpenStreetMap API <ref type="bibr">[11]</ref>, and then converted to a ESRI shapefile. The bounding box used was [-122.514, 37.716, -122.372, 37.859]. In OpenStreetMap, bounding boxes are expressed as four comma-separated numbers, in this order: left, bottom, right, top ([min longitude, min latitude, max longitude, max latitude]). Latitude and longitude are expressed in decimal degrees (north latitude is positive, south latitude is negative, west longitude is negative, east longitude is positive). The dataset is reported in Table <ref type="table">1</ref>, with the geometry column using EPSG:4326 (WGS84) as a geodetic system. Feature osm way id was renamed from to osm id, in order to merge this dataset with the above built shapefile. Then, the speed movements' dataset was merged with the road segments' dataset, based on the common column osm id. In this way we got a dataset with the fields reported in Table <ref type="table">2</ref> including the geometries of each road segment. After merging, data rows with null values were removed from the resulting dataset. The geometry column was then reprojected to the EPSG:3857 projected system, and a new column was created, representing the weekday for each row.</p><p>The use of a projected system does not result from the need to map coordinates in the plane to deal with euclidean distance metrics, but only for calculating the centroid of each road segment, for visualization purposes. The advantage of using road segments instead of road geometries is that the traffic model can also be trained for large geographical areas, covering different projected systems, and traffic data are analyzed at a high geographical resolution. Timestamp was also converted to the local timezone of interest (US/Eastern), and a datetime-index was built on the dataset, to further resample the data with time slots of <ref type="bibr">[2,</ref><ref type="bibr">3,</ref><ref type="bibr">4,</ref><ref type="bibr">6,</ref><ref type="bibr">8,</ref><ref type="bibr">12,</ref><ref type="bibr">24]</ref> hours. For this goal, data were grouped by segment id and resampled by datetime, taking the mean of speed mph mean in the time period of interest, and removing null speed values. Columns [day, hour, week, weekday] were also extracted from the timestamp, converted to categorical (as well as segment id ), and included in the dataset. In this way the temporal component is taken into account, without the need to handle the inherent complexity of time sequences. Once completed this pre-processing phase, each dataset's row was reporting a traffic event, including the average speed value (mph) for a particular road segment, at a particular time (year, month, day, hour ). With the goal of reducing the task to a classification problem, speed values were converted to classes, labeling as low speed values in the range [0, 25] mph, medium speed values in the range (25, 45] mph, and high speed values in the range above 45 mph. Low speed maximum threshold is derived from the definition of low speed vehicle, as reported in the rule 63 FR 33194 (Federal Motor Vehicle Safety Standards), published by the National Highway Traffic Safety Administration. Columns [day, hour, week-day, segment id ] were considered as dataset features. Data were split into train and test sets with a 80/20 ratio, preserving the majority/minority classes ratio. To avoid the curse of dimensionality and to further reduce the complexity of the problem, features were encoded using target encoding <ref type="bibr">[12]</ref>, since using one-hot encoding would create a sparse matrix and increase the number of dimensions. Using target encoding, the labels are directly correlated with the target. For instance, in mean target encoding, the feature label is calculated by averaging the values of the target variables, for each category. In the case of the categorical target, features are replaced with a blend of posterior probability of the target, given a categorical value and the prior probability of the target over all the training data. This technique is particularly useful in the present case, because it does not increase the size of the data and allows for shorter training time. Regularized target encoding outperforms traditional encoding methods, in the case of high cardinality features <ref type="bibr">[13]</ref>. For target encoding, different combinations of smoothing and min samples leaf parameters were tested with no significant changes in the accuracy of the resulting model. The general architecture of the proposed solution is depicted in Fig. <ref type="figure">1</ref>. makes it unnecessary to work with geographic features that introduce nonlinear patterns and are difficult to manage. Statistical techniques are not suitable for very large datasets, while deep learning models are often used to deal with big data. Though, in many cases you have to deal with some cities providing large amounts of data (i.e., for many years with a daily time resolution), and others providing few data with a different time range. Deep learning models are computationally expensive, often require the use of GPU clusters, and have high memory requirements that increase rapidly with dataset size, which could make the problem unmanageable. The development of scalable solutions capable of handling large amounts of data (i.e., implementing efficient traffic prediction for large geographical areas and time intervals), and able to update quickly, requires reducing the dimensional complexity of the dataset and using an approach that eliminates the criticality of the various techniques reported. For these reasons, in order to build a scalable solution we chose to implement both a Random Forest model and a gradient boosting model, using the XGBoost library <ref type="bibr">[14]</ref>, with a multi:softprob objective function (to get class probabilities as model's predictions). Model's outputs are probabilities for each traffic congestion related class (i.e., low, medium and high speed ), which are suitable to show the prediction's confidence with a color gradient scale on the map. Tree-based models are particularly well suited to be used in this context, since they outperform deep learning approaches on tabular data <ref type="bibr">[15]</ref>. The model works as a probabilistic classifier that generalizes the notion of classifiers. Thus, for a given x&#1013;X, it assigns prob-[08:00-16:00), [16:00-00). Relevant training parameters for gradient boosting include learning rate (0.3), maximum number of discrete bins to bucket continuous features (256), grow policy (depthwise), L2 regularization term on weights (1), minimum loss reduction required to make a further partition on a leaf node of the tree (0), maximum depth of a tree <ref type="bibr">(6)</ref>, maximum number of nodes to be added <ref type="bibr">(6)</ref>. Random Forest model was trained defining the fraction of randomly features used to train each tree (80%), learning rate (1), maximum depth (5), number of parallel trees (100), the fraction of the randomly selected training samples used to train each tree (80%). For each training, performance metrics were calculated for the best iteration number, and they are reported in Table <ref type="table">3</ref>. By averaging each model's accuracy, calculated for each time slot, we get an accuracy of 94.78%, with the XGBoost model, which generally outperforms other machine learning or deep learning approaches (e.g., CNN, RNN) [17-19], and 94.81% with the Random Forest model. Training times for each model highlight the efficiency of the model, which is able to scale easily with large amounts of real-time data. (31.1 s for 1H model, 13.5 s for 2H model, 10.4 s for 3H model, 7.06 s for 4H model, 5.32 s for 6H model, 4.18 s for 8H model, 3.05 s for 12H model, 1.74 s for 24H model). Classification metrics for the worst and best cases are reported in Table 4. Confusion matrixes for the worst and best cases are reported respectively in Fig. 2. In the worst and best cases, training times were respectively 31.1 s and 1.74 s, with the traffic dataset of the whole area of San Francisco (4,771,410 rows in the training set and 1,192,853 rows in the test set).</p><p>These metrics are reported only for the XGBoost model, since Random Forest showed comparable results. Features' importances, calculated for 1-hour and 24-hours models (XGBoost), show the features' impact on the model's output magnitude, with road segment's by far the most important feature). The importance was calculated using the cover strategy, thus calculating the average coverage of splits that use the feature, where coverage is defined as the number of samples affected by the split. Results indicate that segment id has the biggest impact on the model's output, and hour is of course useless for the 24hour model (i.e., the bigger the model's time slots, the lesser the importance of time-dependent features). The impact on city traffic is thus affected more by the structure of arterial roads than by the time related features, which can exacerbate critical issues arising from bottlenecks generated by poorly sized roads. Among the temporal components, the greater importance of hour is highlighted, as opposed to day or weekday. In general, temporal features with fine-grained resolution (i.e., hour, minutes) have a greater impact on the traffic predictions, but models with such features are noisier and have worse performance in terms of accuracy. Despite its relative importance, weekday is an important feature that deserves consideration. In the present experiments, the relevance of this feature is limited, having considered one month, whereas for larger time intervals it is an indicator of the seasonality of traffic trends.  </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6">Web Map</head><p>To visualize traffic predictions in an easy way, we developed a web application by converting the dataset with predictions in a GeoJSON format. GeoJSON is a text-based format that uses a simple data structure and is ideal both for accessing and creating geospatial data. The conversion process was automated with a Python script that reads the original dataset and builds the GeoJSON structure, for each date (i.e., day, month, year). The dataset was built using the features day, hour, weekday, segment id, geometry, with three class labels (0: low traffic, 1: medium traffic, 2: high traffic). Predictions provide an array with [y prob 0, y prob 1, y prob 2], where prob x represents the probability of class x . Each traffic layer is represented as a GeoJSON FeatureCollection, with LineString geometries representing the roads. Speed related classes were converted to colors, dark red for low speed (high traffic), red for medium speed (medium traffic), orange for high speed (low traffic). For the purpose of visualizing traffic data on the map, the road's geometries were converted to the EPSG:4326 geodetic system. The web application is structured as an interactive map, built with OpenStreetMap and the Javascript library Leaflet, allowing to zoom and drag.</p><p>learning or deep learning based models, but dealing with geographical features is often a complex task that prevents the model's architeture to scale up efficiently. Statistical approaches allow to identify traffic patterns at different time scales, and are easier to implement, though they are less accurate and are not best suited to deal with multivariate data. Deep learning models are more complex, but they are difficult to handle when the size of the dataset grows exponentially, which is the case with real-time traffic data covering large geopraphical areas.</p><p>With the goal of mitigating the curse of dimensionality, without reducing the information content of the traffic datasets, this paper implemented a strategy for creating a compact predictive model that can be trained on clusters of GPUs, even incrementally so as to update as new traffic data arrives (both historical and real-time traffic data can be used to generate valuable traffic related predictions with our platform). The proposed solution turns out to be easily scalable, upgradeable with new data to take into account larger geographical areas, and has an average accuracy of 94.7% (i.e., calculated by averaging the models' accuracies at various time slots). These results outperform traditional machine learning or deep learning approaches, with the clear advantage of constituting a streamlined and efficient solution that can be easily implemented at large scales with reasonable hardware resources. Cities can make use of this platform to curb critical traffic event issues, with a clear benefit from a pollution and energy-saving perspective, benefiting the productivity and economic development of urban settings. Future directions include taking into account external data (e.g., weather data, social media) and using transfer learning techniques to perform spatio-temporal predictions.</p></div></body>
		</text>
</TEI>
