๐ Real-Time Bus Arrival Prediction Using LSTM with Traffic and Weather Integration ๐ Overview
This project was developed as part of the Machine Learning Internship at PESU Rapid Research Center, PES University (June 2025 โ July 2025). The goal was to design a real-time bus ETA (Estimated Time of Arrival) prediction system that integrates live GPS data, traffic conditions, and weather context to enhance prediction accuracy.
The system employs a Long Short-Term Memory (LSTM) deep learning model, known for its strength in handling temporal dependencies and time-series data, and delivers real-time ETA updates through an interactive Streamlit web dashboard.
๐ง Key Contributions
๐น Developed an LSTM-based model to predict bus arrival times using sequential GPS data and contextual features.
๐น Integrated live traffic and weather data via APIs for real-time prediction refinement.
๐น Built a complete machine learning pipeline โ including preprocessing, feature engineering, model training, and evaluation.
๐น Deployed the system on Streamlit, enabling users to visualize ETA predictions in real time.
๐น Co-authored a research paper submitted to an international AI conference, presenting system design, methodology, and performance analysis.
โ๏ธ Tools & Technologies
Programming Language: Python
Frameworks/Libraries: TensorFlow, Keras, Pandas, NumPy, Scikit-learn
Web Framework: Streamlit
Visualization: Matplotlib, Plotly
APIs: Google Maps API (Traffic), OpenWeatherMap API (Weather)
Development Environment: Jupyter Notebook / VS Code
๐๏ธ System Architecture +-------------------------------------------------------+ | Real-Time Data Sources | | (GPS Feeds) (Traffic API) (Weather API) | +-------------------------------------------------------+ โ โ โ +-------------------------------------------------------+ | Data Preprocessing & Feature Engineering | | - Timestamp alignment | | - Speed & delay feature extraction | | - Context merging (traffic + weather) | +-------------------------------------------------------+ โ +-------------------------------------------------------+ | LSTM-Based ETA Prediction Model | | - Sequence input (past GPS positions & times) | | - Contextual inputs (traffic, weather) | | - Output: Predicted ETA (minutes) | +-------------------------------------------------------+ โ +-------------------------------------------------------+ | Streamlit Web Dashboard | | - Interactive ETA visualization | | - Real-time bus tracking | | - Weather & traffic overlays | +-------------------------------------------------------+
๐งฉ Model Summary
Architecture: LSTM layers with dropout regularization
Loss Function: Mean Absolute Error (MAE)
Optimizer: Adam
Evaluation Metric: MAE โ 4.27 minutes
Training Data: Historical GPS traces enriched with contextual data
๐งช Example Code Snippet import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import LSTM, Dense, Dropout
model = Sequential([ LSTM(64, return_sequences=True, input_shape=(time_steps, feature_dim)), Dropout(0.2), LSTM(32), Dense(1, activation='linear') ])
model.compile(optimizer='adam', loss='mae') history = model.fit(X_train, y_train, epochs=50, batch_size=32, validation_data=(X_val, y_val))
๐ Streamlit Dashboard Features
๐ Live Bus Tracking: Displays real-time bus location updates.
๐ ETA Prediction: Shows expected arrival time based on model output.
๐ค๏ธ Weather Context: Integrates live weather conditions.
๐ฆ Traffic Visualization: Uses color-coded route congestion indicators.
๐ Performance Metrics: Displays model evaluation results interactively.
๐ Results Metric Value Mean Absolute Error (MAE) 4.27 minutes Model LSTM Deployment Streamlit App Integration Real-time Traffic + Weather APIs ๐ Future Work
Extend to multi-route and multi-city datasets.
Incorporate Graph Neural Networks (GNNs) for spatiotemporal modeling.
Optimize for edge deployment on onboard bus systems.
๐งโ๐ป Developer & Research Intern
Nalina S D ๐ Final-year ECE Student, PES University ๐ Internship: PESU Rapid Research Center (June 2025 โ July 2025) ๐ Co-author: โReal-Time Bus Arrival Prediction Using LSTM with Traffic and Weather Integrationโ (AIMLSystems 2025 Submission)