Abstract
This study explores the use of machine learning models to predict traffic conditions in mixed car–bicycle traffic environments. A synthetic dataset was developed from numerical evaluations of traffic flow theory, capturing a wide range of multimodal traffic scenarios. Random forest (RF), multi-layer perceptron (MLP), and linear regression models were trained to estimate key traffic metrics, including output flow, delay, and density. The analysis focuses on model performance under different data splits, especially when sorting by variables such as initial car flow and bicycle flow. Results show that, while RF performs well for previously observed traffic conditions, MLP offers stronger generalization to unseen traffic conditions, particularly in high-flow and high-density regimes. However, prediction performance varies depending on the input variable used for sorting and the distribution of training data. These findings underscore the importance of balanced, diverse datasets and support the use of data-driven models for traffic state estimation in multimodal urban networks.
Introduction
The interaction of diverse vehicle types, including cars, buses, and bicycles, on shared roadways can lead to congestion in urban areas. In particular, slow-moving vehicles, such as bicycles, can act as moving bottlenecks, introducing delays in mixed traffic flow conditions. Understanding the impact of such heterogeneous traffic on overall efficient is essential for developing effective traffic management strategies and guiding infrastructure improvements ( 1 ). To estimate traffic conditions, various approaches have been used over the years. These approaches include physical models based on mathematical equations of traffic flow to describe traffic dynamics, and data-driven models that use real-world data and statistical or machine learning (ML) methods to estimate traffic states ( 2 ).
Traffic flow theory provides a foundational framework to build a physical model for understanding the behavior of traffic streams. One of the most commonly used physical models is the Lighthill-Whitham-Richards (LWR) model, a first-order conservation law that represents traffic states in relation to traffic flow and density. This model describes the evolution of traffic density on road segments through a partial differential equation and assumes that a fundamental diagram governs the relationship between flow and density ( 3 ). Over the years, various numerical methods have been developed to solve the LWR model, including the finite difference method, the cell transmission model (CTM), and the Lax–Hopf formulation ( 4 – 6 ). Among these, the Lax–Hopf solution is particularly notable for its computational efficiency in modeling traffic flow ( 7 , 8 ).
To extend the Lax–Hopf approach to multimodal traffic scenarios, a numerical evaluation has been proposed that solves for the cumulative vehicle counts at each space-time point by minimizing over a set of constraints ( 9 , 10 ). This framework can incorporate moving bottlenecks, such as buses or bicycles, as internal constraints to the traffic counts ( 1 ). This approach has proven effective for modeling complex traffic dynamics and has been applied to evaluate real-time strategies such as variable speed limits and ramp metering on highway networks. In such cases, the Lax–Hopf method has outperformed traditional models such as the CTM in both computational speed and accuracy, enabling real-time implementation ( 11 ).
However, when applied to mixed traffic conditions involving multiple vehicle classes, the computational demands of the Lax–Hopf solution increase significantly. For instance, in a study exploring the interactions between buses and cars to assess transit signal priority, a dynamic programming algorithm leveraging the Lax–Hopf method was developed ( 12 ). While the model produced accurate results, the need to simulate numerous shockwave interactions, especially those introduced by moving bottlenecks, resulted in it being computationally intensive and impractical for real-time deployment.
Data-driven algorithms, such as ML models, can learn from data to make accurate predictions while reducing computational demands. A common application involves utilizing historical traffic data to predict traffic flow. Although not the primary focus of this paper, many recent studies have considered the use of models such as random forest (RF), deep autoencoder, deep belief network, and/or long short-term memory (LSTM) for traffic prediction. Among these, LSTM models frequently outperform other ML models used for this purpose ( 13 , 14 ). Because of their relatively simple structure, many of these models offer low computational costs. However, their dependence on historical data can limit reliability in unexpected of atypical traffic scenarios. Furthermore, the method can be thought of as a “black box,” making it challenging to derive interpretable or causal insights ( 15 – 19 ). Hybrid approaches have also been proposed, for example combining a hidden Markov model with an LSTM network to enhance predictive capability ( 20 ).
Several approaches have explored the integration of theoretical traffic models with ML approaches to improve model performance and transferability ( 21 ). For example, one study modified model inputs using kinematic-wave theory, specifically the simplified theory of kinematic waves, for an LSTM to improve traffic flow predictions ( 22 , 23 ). Other efforts have used kinematic wave theory to generate synthetic data, which is then combined with real data to improve ML models that aim to predict traffic conditions. One such work used kinematic wave theory to create synthetic traffic data representing free-flowing, slow-moving, and congested conditions, and used it to train a deep convolutional neural network for high-resolution speed estimation based on sparse probe vehicle trajectories ( 24 ). Another study leveraged the Lax–Hopf method to generate synthetic traffic datasets and employed a physics-regulated deep learning (PRDL) model for traffic state estimation. The results suggested that synthetic data could improve the performance of the hybrid model in environments with limited historical information. The authors reported that their method improved estimation accuracy by over 12% and reduced training time by more than 50% compared with conventional PRDL approaches, making it a promising solution in data-scarce or data-expensive scenarios ( 25 ).
However, existing studies have primarily focused on single-mode traffic, where the demand for one vehicle type is the primary determinant of traffic flow. In multimodal scenarios, the complexity increases significantly, as interactions between different vehicle types and their respective demands play a critical role in shaping traffic dynamics. These interactions can lead to more nuanced queuing patterns that affect delays and overall flow characteristics. To date, no study has systematically explored the range of multimodal traffic conditions under which ML methods remain effective for delay prediction, nor has there been significant investigation into how well these models extrapolate to previously unseen traffic conditions. In this case, ML can be applied to datasets generated through numerical evaluations of analytical traffic models to predict traffic states across diverse conditions. It is important to note that the ML models used in this study are not fundamentally different from those applied in homogeneous traffic contexts. The key difference lies in the structure of the learning problem. In mixed traffic, the presence of multiple interacting demand variables (e.g., car and bicycle flows) introduces a higher-dimensional and non-linear relationship between inputs and outputs traffic states. This work therefore focuses on evaluating how standard ML models perform under these conditions, particularly in their ability to generalize across different demand regimes and to extrapolate beyond the training data.
The primary objective of this paper is to demonstrate the applicability of ML methods as computationally efficient surrogates for numerical traffic flow evaluations, specifically for mixed traffic conditions, and to assess their ability to generalize beyond conditions represented in the training data. Specifically, the study aims to:
1) Develop a comprehensive dataset from numerically evaluated car–bicycle mixed traffic flow. The input features include bicycle flow, initial car flow, opposing car flow, car speed, bicycle speed, and opposing car speed.
2) Train and benchmark several ML models on this dataset to predict traffic flow, delay, and density on a roadway within a defined time-space domain and compare model architectures to identify the most accurate and efficient approaches.
3) Evaluate the ability of trained ML models to predict traffic conditions for variable ranges not represented in the training data, assessing whether the models can capture the underlying physics of multimodal traffic operations.
The remainder of the paper is organized as follows. First the dataset used in the paper is described, followed by the methodology utilized. Next, the results of applying ML methods to predict mixed-traffic flow capacity and delays are described. Finally, some concluding remarks are presented.
Dataset
The dataset used in this study is derived from a dynamic Lax–Hopf formulation of the LWR model, applied to a two-lane roadway scenario where cars must cross into the opposing traffic lane to pass bicycles. The Lax–Hopf formulation calculates cumulative vehicle counts at each time-space point while incorporating internal conditions that model a series of moving bottlenecks created by bicycles. The model assumes that cars and bicycles are uniformly distributed in space; however, the speed of each individual bicycle on the road was drawn from a random normal distribution with a mean bicycle speed and a standard deviation of 0.25 times the mean bicycle speed. Previous work has shown that introducing randomness into the model yields more realistic outputs by disrupting repetitive patterns ( 26 ). A key feature of the model is the inclusion of bounded vehicle acceleration, which reflects realistic driving behavior by acknowledging that cars cannot instantaneously reach their desired speed. This constraint is especially important for accurately capturing car–bicycle interactions during passing maneuvers.
Traffic conditions were rigorously defined through initial, upstream, downstream, and internal boundary conditions, enabling analytical estimation of the delays introduced by bicycles in mixed traffic. The initial spatial density along the segment was set consistent with the fundamental relationship of:
where
q 0 = the initial car flow, and
v f = the corresponding free-flow speed.
(Equation 1 ensures consistency between initial and boundary conditions).
Full details of the Lax–Hopf implementation for this mixed car–bicycle traffic scenario are provided in Lu et al. ( 26 ). It is important to note that the initial car flow used as a model input is an upstream boundary condition (i.e., inflow rate) rather than the output flow; for example, what would be observed as an output from the fundamental diagram. In the Lax–Hopf framework, the initial and boundary conditions together determine the realized traffic state: high inflow combined with high bicycle density pushes the segment toward capacity and induces congestion, while low inflow with low bicycle density results in free-flow conditions. Sorting by initial inflow therefore provides meaningful separation of traffic regimes.
As illustrated in Figure 1, the queuing patterns induced by moving bottlenecks (i.e., bicycles) repeat consistently throughout the 200 m × 100 s time-space domain. Each bicycle generates a characteristic queue signature—visible as the diagonal high-density bands—that form, propagate, and dissipate within the analysis window. The similar nature of these patterns confirms that the selected domain is sufficiently large to capture the full cycle of car–bicycle interaction dynamics. Extending the spatial or temporal horizon would not introduce qualitatively new behavior; it would simply replicate the same repeating patterns. Conversely, a smaller domain would risk truncating these dynamics before they fully resolve. The 200 m × 100 s window therefore represents a well-justified choice that captures the essential physics of the mixed-traffic scenario while remaining computationally tractable.

Time–space diagram of traffic density for a representative simulated scenario.
From the cumulative vehicle counts obtained through this numerical evaluation, three key traffic flow features are extracted: 1) output flow, representing roadway capacity, 2) delay, and 3) roadway density.
The output flow was calculated as the cumulative count at the downstream end of the analysis window (x = 200 m) at the end of the analysis (t = 100 s).
The delay was calculated using cumulative count curves as the area between the downstream and upstream cumulative count curves, and subtracting the free flow travel time.
The output density was derived using Edie’s generalized density definition, which expresses density as the ratio of total time spent in the system by cars to the total area of the space-time domain, as shown in Equation 2:
where
total travel time = the sum of local densities k(x,t) across all time and space cells.
Each density value in the matrix K was first multiplied by the spatial resolution, Δx, to represent the number of cars, and then by the temporal resolution, Δt, to determine the travel time for each cell in units of vehicle-seconds. The denominator was computed as the product of 100 s and 200 m time-space domain. This value represents the overall density within the studied region, accounting for temporal and spatial variations in vehicle movement.
Since the density is not an immediate output from the Lax–Hopf formulation, the roadway was divided into discrete cells of 0.1 s and 0.1 m to estimate the distribution of vehicles along the road. This provided detailed density information, but at a substantially high computational cost.
Data Generation
Data were generated through repeated numerical evaluations of the Lax–Hopf formulation described above. By systematically varying the input parameters—bicycle flow, initial car flow, opposing car flow, car speed, bicycle speed, and opposing car speed—a comprehensive dataset was produced. For each combination of input values, the corresponding output flow, delay, and density were computed, capturing a wide range of mixed traffic conditions.
Table 1 provides the ranges of the input and output variables, which is essential for training and testing ML models in this dataset. The wide range of values in initial car flow and bicycle flow result in high variability in traffic conditions. Specifically, scenarios with near-zero delay and low output density (approaching 1.63 vehicles per kilometer [vpkm]) correspond to free-flow conditions where bicycle interference is minimal, while scenarios with high delay (up to 1,264 s) and high density (up to 135.82 vpkm) represent congested conditions in which bicycles create sustained queues. The dataset therefore spans the full spectrum from free-flow to heavily congested regimes.
Dataset Statistics
Note: bph = bicycles per hour; Max. = maximum; Min. = minimum; SD = standard deviation; vph = vehicles per hour; vpkm = vehicles per kilometer.
Methodology
The primary goal of this study is to develop ML models as computationally efficient surrogates for the Lax–Hopf numerical traffic evaluation. Running the Lax–Hopf formulation across the full space of possible mixed car–bicycle demand combinations is computationally expensive. The ML models are therefore trained on a carefully designed subset of scenarios and used to predict outcomes for conditions not considered, replicating the behavior of the physics-based model at a fraction of the cost. Understanding how these surrogate models behave when applied to demand conditions outside their training range is essential to their reliable deployment. This study adopts a data-driven approach to predict traffic flow, delay, and density in mixed car–bicycle traffic scenarios using ML models. The research framework integrates numerical simulations grounded in traffic flow theory with ML techniques to enhance predictive accuracy and computational efficiency. Three ML models were utilized: multi-layer perceptron (MLP), RF, and multiple linear regression (MLR). While LSTMs are highly effective for time-series prediction, this work does not involve a temporal component; that is, the data represent a single snapshot in time and the inputs do not include historical observations. Further, LSTMs typically require large amounts of data to train effectively. For these reasons, an LSTM architecture was not appropriate for this problem. Instead, an MLP was chosen for its ability to efficiently model nonlinear relationships and its strong performance on moderate-sized, non-temporal datasets.
The neural network model implemented in this study is an MLP, a type of feedforward artificial neural network ( 27 ). The specific architecture of our MLP consists of an input layer with neurons corresponding to the number of input features, two hidden layers each containing 64 neurons, and an output layer with neurons corresponding to the number of output variables (i.e., flow, delay, and density). The hidden layers use rectified linear unit (ReLU) activation functions, while the output layer uses a linear activation function. The model is optimized using the Adam algorithm with a learning rate of 0.01. The use of ReLU activation functions in the hidden layers is supported by research showing its effectiveness in preventing vanishing gradients and promoting sparse activations, which can lead to better generalization. The Adam optimizer was chosen for its adaptive learning rate, which has been shown to perform well across a wide range of problems ( 28 ).
The RF model is an ensemble learning method that constructs multiple decision trees during training. In this study, 50 trees were used in the forest. It outputs the mean prediction (i.e., regression) of the individual trees. All trees were allowed to grow until all leaves are pure or contain less than two samples, without setting a maximum tree depth. RF is known for its high accuracy, robustness to overfitting, and ability to handle large datasets with higher dimensionality. Therefore, this model is expected to be suitable for predicting mixed-traffic flow properties because of its ability to handle noisy data.
The hyperparameters used for both the MLP (e.g., number of neurons per layer) and RF (e.g., number of trees) were selected through a grid-search tuning procedure that evaluated candidate configurations and chose the settings that minimized validation error.
Linear regression (LR) models the relationship between a dependent variable and multiple independent variables by fitting a linear equation to observed data. This method is simple and interpretable, making it suitable for understanding the impact of each predictor on the outcome. However, LR assumes a linear relationship between the input features and the target variables, which may not capture complex interactions as effectively as non-linear models. In this study, LR was used as a baseline to demonstrate the benefits of the more advanced ML models, such as RF and MLP, in predicting traffic flow and delay in mixed car–bicycle traffic scenarios.
Model Evaluation
We evaluated these models’ performances using mean absolute error (MAE), root mean squared error (RMSE), and R2 as defined below.
where
MAE and RMSE measure the error of the predictions, with MAE providing an average magnitude of errors in the same units as the data, while RMSE penalizes larger errors more heavily by squaring them before averaging and taking the square root. While MAE gives equal weight to all errors, RMSE emphasizes larger errors, making it more sensitive to outliers. Meanwhile, R2 evaluates the model’s effectiveness by determining how much of the data’s variance is explained by the regression model.
Results
A key practical challenge in surrogate model deployment is that the training data may not cover all demand conditions of interest; for example, a limited computational budget may allow only low-to-moderate car and bicycle flow scenarios to be evaluated. To evaluate how well the ML surrogates generalize to demand conditions outside their training range, model performance was first evaluated using a sorted dataset, in which the lowest 80% of a feature’s value range was used for training and the highest 20% for testing. This setup directly tests the model’s ability to extrapolate to novel, previously untested demand conditions. The input features included bicycle flow, initial car flow, opposing car flow, car speed, bicycle speed, and opposing car speed. These variables were used to predict the corresponding output flow, delay, and density for a specific road segment over a defined evaluation period. The following sections provide a detailed analysis of model predictions for each of the three output variables—output flow, delay, and density—and examine the differences in behavior across the RF, MLP, and LR models. In addition, the impact of the sorting-based data partitioning strategy on model accuracy and generalization is assessed.
Output Flow
The evaluation of the predictions of output flow for the RF, MLP, and LR models are shown in Table 2, considering the dataset that was sorted based on different input parameters. As can be seen, the RF model outperforms the other two models for most evaluation metrics, achieving the highest R2, and lowest MAE and RMSE. considering all variables that the data was sorted over.
Performance of Random Forest (RF), Multi-Layer Perceptron (MLP), and Linear Regression (LR) on Output Flow Prediction, Sorted Based on Each Feature
Note: MAE = mean absolute error; RMSE = root mean squared error.
To better understand the model predictions, the actual versus predicted values of the output flow for the RF, LR, and MLP models when the data is sorted on initial car flow is shown in Figure 2a. While LR is simple and interpretable, it assumes a linear relationship between input features and target variables, limiting its ability to capture complex interactions. The results showed that RF, although achieving a higher R2, fails to predict high flow conditions unseen during the training. This is better illustrated in the histograms of the predicted output flow compared with the actual values for RF and MLP models shown in Figure 1, b and c , respectively. As can be seen in these histograms, the RF model does not predict any output flows larger than 1,200 vehicles per hour (vph), since these values are not seen in the training data.

(a) Actual versus predicted values of the output flow for random forest (RF), multi-layer perceptron (MLP), and linear regression (LR) for input data sorted based on initial flow, (b) histogram of prediction of output flow using RF compared with the actual values, and (c) histogram of prediction of output flow using MLP compared with the actual values.
Delay
In addition to output flow prediction, delay predictions for the RF, MLP and LR models were evaluated, considering a dataset that were sorted based on different input parameters, and is summarized in Table 3. This table provides a summary of the delay R2, MAE, and RMSE metric values. RF consistently achieves the highest R2 scores and lower MAE/RMSE values across most sorting parameters, indicating strong performance in delay prediction. However, MLP performs closely in many cases, often approaching the accuracy of RF and clearly outperforming LR.
Performance of Random Forest (RF), Multi-Layer Perceptron (MLP), and Linear Regression (LR) on Delay Prediction, Sorted Based on Each Feature
Note: MAE = mean absolute error; RMSE = root mean squared error.
Figure 3a shows the actual and predicted values of the LR, RF, and MLP models when the data is sorted on initial car flow. Similar to the output flow prediction model, the delay prediction plots reveal key differences in model behavior. While RF achieves slightly higher R2 scores overall, MLP shows better alignment with the perfect prediction line, particularly in high-delay scenarios, indicating stronger generalization to unseen data. The LR model remains the weakest, with scattered predictions and consistent underestimation, failing to capture the complex, non-linear nature of delay dynamics. Figure 3, b and c , presents histograms of delay predictions for the RF and MLP models, respectively, comparing predicted values to the actual observations. These plots further illustrate that the MLP model generalizes more effectively to unseen data, particularly in the higher delay ranges, than the RF model.

(a) Actual versus predicted values of the delay for random forest (RF), multi-layer perceptron (MLP), and linear regression (LR) for input data sorted based on initial flow, (b) histogram of prediction of delay using RF compared with the actual values, and (c) histogram of prediction of delay using MLP compared with the actual values.
Density
The quantitative performance of the MLP, RF, and LR models predicting the density under various sorting strategies based on input features is summarized in Table 4. The metrics reported—R2, MAE, and RMSE—highlight how model accuracy is influenced by which variable the dataset is sorted on before training and testing. The table shows that RF and MLP both achieve high R2 scores and low error metrics across most sorting parameters, with MLP slightly outperforming RF in some cases. LR consistently lags, particularly in R2, indicating it struggles to model density accurately compared with RF and MLP.
Performance of Random Forest (RF), Multi-Layer Perceptron (MLP), and Linear Regression (LR) on Density Prediction, Sorted Based on Each Feature
Note: MAE = mean absolute error; RMSE = root mean squared error.
Figure 4a shows predicted versus actual output density using LR, MLP, and RF models when the data is sorted on initial car flow. Compared with the output flow and delay predictions, the performance of all models for density predictions drops significantly. Both the MLP and RF models maintain the overall trend but systematically underpredict in the high-density regions, specifically beyond 60 vpkm, while the LR model cannot accurately predict even in low density scenarios. Regardless, the MLP model outperforms the RF model in these unseen scenarios. Figure 3, b and c , shows the distribution of actual versus predicted output densities using the RF and MLP models, respectively, when the dataset is sorted by initial car flow. While the actual density values span a wide range, extending beyond 120 vpkm, the predicted distribution is noticeably shifted to the left and compressed, with most values concentrated below 70 vpkm. This confirms that the MLP model, although capturing the overall trend, systematically under predicts high-density values because of the absence of high initial flow cases in the training set.

(a) Actual versus predicted values of the density for random forest (RF), multi-layer perceptron (MLP), and linear regression (LR) for input data sorted based on initial flow, (b) histogram of prediction of density using RF compared with the actual values, and (c) histogram of prediction of density using MLP compared with the actual values.
Comparison of LR, RF, and MLP: Output Flow, Delay, and Density
The overall comparison across output flow, delay, and density highlights distinct strengths and limitations of the LR, RF, and MLP models. Among the three, RF generally achieved the highest R2 values, particularly when the training and testing sets were relatively similar. However, its performance declined when extrapolating beyond the training range, especially for high values of the target variable.
For output flow prediction, RF attained an R2 of 0.90 when sorted by initial car flow, outperforming MLP (0.85) and LR (0.20). Despite its strong overall performance, RF struggled to generalize to high-flow conditions, where MLP demonstrated slightly better accuracy in this higher, unseen range. LR consistently showed poor performance across all sorting strategies, reaffirming its limitations in modeling non-linear traffic dynamics.
In delay prediction, RF once again led with R2 values exceeding 0.95 in most scenarios, followed closely by MLP. Although RF had slightly higher average R2 scores, MLP often matched or outperformed it in generalized to unseen high-delay cases. This trend was particularly evident under initial flow-based sorting, where MLP more reliably tracked the actual delay patterns. LR remained the weakest performer, with R2 values dropping as low as 0.11 in some settings.
Density prediction posed the greatest challenge for all models. Under the sorted by initial car flow scenario, the performance declined substantially: RF achieved an R2 of only 0.62, while MLP performed marginally better at 0.79. Both models underpredicted high-density values, with MLP’s predictions notably compressed and left-shifted, confirming poor generalization in unseen high-density regions. This was mainly because of the sorted–split design introducing a stronger distributional shift between the training and testing sets for density than for flow or delay. The training set (the first 80% of samples) contained primarily low- to mid-density conditions, while the testing set was dominated by previously unseen high-density states. Consequently, imbalance-mitigation techniques such as class weighting or oversampling were ineffective, as the high-density regime was largely absent from the training data. In addition, density in this study was computed using Edie’s generalized definition, which integrates vehicle presence over both space and time. This formulation is highly sensitive to small fluctuations in flow and speed, leading to amplified variability in estimated density. The scarcity of high-density cases reflects the traffic simulation setup itself, where only a limited set of input combinations (e.g., high bicycle and vehicle flows combined with low speeds) produced congestion severe enough to reach those levels. Collectively, these factors contributed to systematic underprediction in the high-density range.
In summary, MLP offered a more robust solution for handling extrapolation in unseen data ranges, especially under sorted splits, while RF performed well on seen data but struggled at the boundaries. This behavior reflects underlying model properties: neural networks can approximate continuous functions and therefore support limited extrapolation beyond the training range, whereas RFs rely on discrete splits in the observed feature space, which prevents them from predicting outside the distribution of training data. LR, limited by its simplicity, failed to deliver adequate performance in any task. The feature importance analysis further confirms this; focusing on initial car flow, while challenging, helps reveal how well each model can handle imbalanced data and make predictions in less familiar conditions.
Feature Importance Analysis
Figure 5 shows feature importance values extracted from the RF model. The feature importance analysis shows that initial car flow is consistently the most influential predictor across all three targets: output flow, delay, and density. This is likely because of its wide value range and strong correlation with traffic system behavior, making it a key driver of flow dynamics. Bicycle flow and opposing flow follow in importance, while opposing car speed ranks lowest, likely because of its limited variation and reduced impact on the output metrics.

Feature importance for output flow, delay, and density.
Notably, the high variability of initial car flow makes it a dominant factor, but also introduces complexity in modeling, supporting the decision to evaluate model performance specifically when data is sorted by this parameter.
Model Performance across Different Splits Sorted Based on Initial Flow
To systematically evaluate surrogate model generalization, the dataset was split in different ways, each addressing a distinct research question. A random split evaluates in-distribution generalization: how accurately can the surrogate predict for demand combinations statistically similar to those used in training? A sorted split evaluates out-of-distribution generalization: if the surrogate is trained on low-to-moderate demand scenarios, how well does it generalize to higher demand conditions never encountered during training? Batch splits examine generalization across specific flow bands: if trained only on one demand range, can the model predict accurately for conditions outside that band? These scenarios reflect realistic challenges in surrogate model deployment. Note that only the MLP model is evaluated here since it seems to outperform the RF model in predictions in unseen ranges of traffic conditions. The different splitting factors considered are:
1) Sorted split: The dataset was split such that the initial car flow values were sorted in ascending order, and then the first 80% was used for training and the remaining 20% for testing.
2) First half: The first half of the sorted dataset was used for training and randomly 20% of the remaining data was tested.
3) Second half: The second half of the sorted dataset was used for training and randomly 20% of the remaining data was tested.
4) Random test batches: The dataset was first sorted by initial car flow and divided into five consecutive batches of equal size. In each experiment, one batch was chosen at random and used as the training set, and 20% of samples were randomly selected from the remaining four batches to form the test set. This setup ensured that the test data represented flow conditions not included in the training batch, allowing us to assess generalization under unseen regimes.
The MLP model was evaluated based on MAE, RMSE, and R2 metrics, and Table 5 shows the results.
Multi-Layer Perceptron Model Performance across Different Splits
Note: MAE = mean absolute error; RMSE = root mean squared error.
The analysis of the MLP across various data splitting scenarios highlights several key findings. The sorted split scenario, where data is organized by initial car flow, shows moderate performance with R2 values for all three outputs, indicating that the model captures the relationship reasonably well under these conditions but may still face challenges because of variability in initial car flow. The first half scenario displays lower performance across all metrics, but particularly for density (R2 = 0.43). This suggests that, while some patterns are learned, this portion of the data lacks high-density scenarios, limiting the model’s ability to generalize fully.
In contrast, the second-half split, which includes most of the high-density values, results in significantly better performance for all three metrics. This indicates that exposure to more complex, high-density traffic conditions enables the model to capture underlying dynamics more effectively.
The batch scenarios yield mixed results. Batch 1 performs poorly, likely because of data imbalance or a concentration of low-density samples. In contrast, batches 2–4 perform better, indicating consistent model accuracy when trained on higher initial car flows. Batch 5, trained only on high initial flow scenarios and tested on lower initial flow ones, performs well on predicting output flow and delay; however, it has the worst performance for predicting density (R2 = 0.23). This demonstrates that the model has difficulty in generalizing downward to lower, unseen density regimes when trained solely on heavy traffic conditions.
Figure 6 shows the MLP model’s performance across different split scenarios when the data is sorted by bicycle flow. The results follow a similar trend to those seen with initial car flow sorting. While sorting by bicycle flow improves generalization in some cases, it does not consistently enhance performance, particularly for density, where the decline is more pronounced.

R 2 comparison across sorting methods (initial flow and bicycle flow).
Overall, the results indicate that the MLP model performs reliably across various traffic scenarios, with better prediction accuracy in middle batches or when data is sorted by higher flow regimes. Careful data splitting remains important, as the performance disparities in certain batches highlight the need for representative training sets. The model’s performance on sorted and later data demonstrates its ability to generalize effectively when exposed to a wide range of traffic conditions.
Discussion and Conclusions
This study evaluated the predictive performance of three ML models, namely MLP, RF, and LR, in estimating key traffic metrics in multimodal, mixed car–bicycle traffic scenarios. The analysis began with generating data using numerical evaluations of traffic flow theory and testing the ML models on sorted datasets, using selected input features to assess prediction accuracy for output flow, delay, and density.
When datasets were sorted by various input features, RF generally achieved the best performance on data similar to its training set, highlighting its ability to capture non-linear relationships under familiar conditions. However, its accuracy declined when faced with unseen traffic states, especially in high-flow and high-delay cases. MLP, while slightly less accurate on training-aligned data, demonstrated greater robustness in extrapolating to unfamiliar scenarios. This behavior reflects underlying model properties, where MLPs are parametric, continuous function approximators, and can help learn smooth mappings that approximate underlying continuous relationships. On the other hand, RFs rely on partitioning the observed feature space, which prevents them from predicting outside the distribution of training data. This was particularly evident in cases sorted by initial car flow, where higher variability challenged all models—yet MLP maintained more stable performance. In contrast, LR, constrained by its linear formulation, consistently underperformed across all scenarios.
Predicting density emerged as the most difficult task, especially when the training data did not cover the full range of traffic conditions. Models struggled to generalize to unobserved density extremes, particularly when training splits excluded critical high-density cases. However, when data was sorted by bicycle flow, MLP showed improved performance in density prediction, which suggests that bicycle flow captures meaningful variations in system-wide congestion and may serve as a useful organizing feature for density-focused tasks.
In the second phase of the analysis, MLP performance was examined under different data splitting strategies, particularly when sorted by initial car or bicycle flow. These scenarios were designed to the model’s generalization capabilities. Balanced splits, which spanned a wide range of traffic conditions, resulted in better performance across all output variables. In contrast, imbalanced splits (trained solely on low- or high-flow subsets) revealed clear limitations in model adaptability.
Overall, the findings demonstrate that ML models, especially MLP, are effective tools for predicting traffic flow, delay, and density in mixed car–bicycle environments. RF performed best on familiar data because of its strength in modeling non-linear patterns, but MLP consistently outperformed it in unfamiliar or extrapolated conditions, particularly in high-flow or high-density regimes. Across all metrics, models trained on diverse, balanced datasets yielded more reliable results, while those trained on narrower data ranges struggled to generalize. These insights underscore the importance of strategic data collection in future multimodal traffic studies: ensuring coverage across a wide range of traffic states is more critical than simply collecting more data.
A key limitation of this study is that all results were derived from a synthetic dataset generated through numerical traffic flow evaluations. While this approach enabled systematic exploration of a wide spectrum of multimodal conditions, it does not reflect all complexities present in real-world mixed traffic. Accordingly, these findings should be interpreted within the context of the modeling assumptions inherent to synthetic data. A further limitation of the underlying framework is that the first-order LWR model with a triangular fundamental diagram cannot capture capacity drop at active bottlenecks. Consequently, the model may underestimate congestion severity in scenarios where capacity drop would be triggered in reality. Validation of the Lax–Hopf model itself against real-world mixed car–bicycle trajectory data or microsimulation tools such as VISSIM or SUMO is an important future direction, but falls outside the scope of the current study, which focuses on ML surrogate performance relative to the physics-based model.
Despite this limitation, the results of this study provide practical guidance on how ML models can be leveraged for mixed-traffic state estimation and illustrate conditions under which different algorithms perform more reliably. These findings contribute to the development of scalable, adaptive, and data-driven traffic monitoring tools suited to evolving urban mobility demands.
Future Work
Future research should investigate model performance using real-world multimodal trajectory data or detector-based observations to evaluate alignment between synthetic predictions and actual mixed-traffic behavior. The reported results are specific to the defined 200 m segment and 100 s horizon. While this scale captures localized mixed-traffic interactions, sensitivity to alternative spatial and temporal aggregations was not evaluated and remains an important direction for future work. Additional extensions may include studying interactions involving other vehicle classes (e.g., buses, motorcycles), testing diverse roadway geometries or lane configurations. These efforts would provide insight into model transferability under more complex and heterogeneous operational environments and support eventual deployment in practical traffic monitoring applications.
Footnotes
Author Contributions
The authors confirm contribution to the paper as follows: study conception and design: F. Fathijam, S. Guler; data collection: F. Fathijam, S. Guler; analysis and interpretation of results: F. Fathijam, S. Guler; draft manuscript preparation: F. Fathijam, S. Guler. All authors reviewed the results and approved the final version of the manuscript.
Declaration of Conflicting Interests
The authors declared the following potential conflicts of interest with respect to the research, authorship, and/or publication of this article: S. Guler is a member of Transportation Research Record’s Editorial Board.
Funding
The authors received no financial support for the research, authorship, and/or publication of this article.
Data Availability Statement
The datasets generated during and/or analyzed during the current study are available from the corresponding author on reasonable request.
