Comparative Analysis of Machine Learning Models for Traffic Prediction
摘要
In the field of transportation planning and management, traffic prediction is a crucial problem where machine learning algorithms have demonstrated encouraging outcomes. The machine learning models for traffic prediction, including K-Nearest Neighbors (KNN), Random Forest, Long Short-Term Memory (LSTM), and Moving Average, are compared in this paper. The objective of this work is to determine how well these models performed in identifying traffic patterns and to appraise their accuracy by utilizing measures like Root Mean Square Error (RMSE), Mean Absolute Error (MAE), and R-squared. We preprocessed the data by transforming the datetime values to numerical representation using a historical traffic dataset. To train and evaluate the model, the dataset has been divided into training and testing sets. Moving Average functioned as a baseline but it is not sensitive enough to identify intricate patterns. These results emphasize how crucial it is to choose models according to task requirements and dataset peculiarities. Random Forest demonstrated its capability for precise traffic prediction, whereas temporal interdependence and local patterns could be captured by KNN and LSTM, respectively. A basic baseline has been shown using moving average. The performance and applicability of machine learning models for traffic prediction has been evaluated in this paper. The results can help the researchers in this area model depending on the features of the dataset and particular needs. With an RMSE of 3.83, MAE of 2.66, and R-squared of 0.96, Random Forest has shown to perform the best, successfully capturing all the relationships. With an RMSE of 21.87, MAE of 16.49, and negative R-squared, KNN performed worst. With an RMSE of 4.99, MAE of 2.90, and R-squared of 0.75, LSTM demonstrated a moderate level of performance.