###### Abstract  
This study delves into the intricate dynamics of urban mobility, a pivotal aspect for policymakers, businesses, and communities alike. By deciphering patterns of movement within a city, stakeholders can craft targeted interventions to mitigate traffic congestion peaks, optimizing both resource allocation and individual travel routes. Focused on Barcelona, Spain, this paper draws on data sourced from the city council's open data service. Through a blend of exploratory analysis, visualization techniques, and modeling methodologies--including time series analysis and the eXtreme Gradient Boosting (XGBoost) algorithm--the research endeavors to forecast traffic conditions. Additionally, a study of variable importance is carried out, and Shapley Additive Explanations are applied to enhance the interpretability of model outputs. Findings underscore the limitations of traditional forecasting methods in capturing the nuanced spatial and temporal dependencies present in traffic flows, particularly over medium- to long-term horizons. However, the XGBoost model demonstrates robust performance, with the area under ROC curves consistently exceeding 80%, indicating its efficacy in handling non-linear traffic data variables. traffic level; eXtreme Gradient Boosting; forecasting; mobility; open data +
Footnote †: journal: Medical  
design may enable the selection of the optimal number and location of public charging stations for electric vehicles, which may increase the use of these vehicles. For companies, being able to estimate their social and environmental impacts, combined with intelligent methods, helps them to design distribution processes that minimize these impacts, which tend to be correlated to economical costs [7]. Thus, high quality data are potentially useful for modeling and addressing optimization problems related to urban mobility [8]. Regarding the availability of data, there is an increasing number of initiatives aiming to share data for the common good and for the benefit of anyone. For instance, the city of Chicago has an open data portal ([[https://data.cityofchicago.org/](https://data.cityofchicago.org/)]([https://data.cityofchicago.org/](https://data.cityofchicago.org/)), accessed on 2 April 2024) which enables the creation of maps and graphs to gain insights about plenty of facts (salaries, violence, vaccinations, etc.). One of the advantages of these types of portals is that data are frequently updated (faster than the statistics typically offered by national statistics institutes). There are also initiatives proposed by private companies such as Carbon Footprint Ltd. ([[https://www.carbonfootprint.com/aboutus.html](https://www.carbonfootprint.com/aboutus.html)]([https://www.carbonfootprint.com/aboutus.html](https://www.carbonfootprint.com/aboutus.html)), accessed on 2 April 2024), which offers some online calculators to estimate the average carbon footprint of individuals and small businesses for free. Despite the emergence of these initiatives, ref. [5] states that there is a lack of sufficiently granular indicators and related data on urban mobility (such as modal split, environmental impacts, congestion, energy use). The reason is that cities are not required to collect and provide these data. However, the increasing adoption of Internet of Things technologies (e.g., intelligent traffic lights, road sensors, or sensors in trash and recycling containers) and awareness of the potential of open data portals suggest that the availability of data will continue to increase during the next years. Traffic modelization and prediction constitute an arduous endeavor because of the high non-linearity and complexity of traffic flow. Recently, classic statistical models have been challenged by machine learning and deep learning methods in traffic prediction tasks [9]. This is due to the fact that traditional methods cannot make predictions in the medium-long term and fail to consider the spatial and temporal dependencies in the data [10].