Bus Travel Time Prediction under Heterogeneous Traffic Conditions Using a Transformer Encoder-Based Model: A Comparative Study
Accurate bus travel time prediction is essential for improving service reliability, passenger information systems, and operational efficiency in public transportation. However, predictions remain challenging under heterogeneous traffic conditions commonly observed in developing countries due to mixed traffic flow, weak lane discipline, and highly variable delays. This study presents a comparative evaluation of three forecasting approaches, namely ARIMA, LSTM, and a Transformer encoder-based model, using real-world automatic vehicle location data collected from the Digana-Kandy corridor in Sri Lanka. The data set consists of 5,126 bus journeys recorded over five months. Travel times were aggregated into 30-minute intervals, and all models were evaluated using the same preprocessing procedure, 80:20 train-test split, and error metrics. Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), and Root Mean Squared Error (RMSE) were used for evaluation. Results show that the Transformer encoder-based model achieved the best predictive performance with an MAE of 2.10 min, MAPE of 4.52%, and RMSE of 3.76 min, outperforming both LSTM and ARIMA models. The findings highlight the potential of Transformer encoder-based architecture for intelligent public transport applications and real-time bus arrival prediction under heterogeneous traffic conditions.