A machine learning-powered system that optimally allocates vehicles in urban networks based on real-time traffic congestion predictions. This project combines graph theory with predictive modeling to improve traffic flow efficiency and reduce congestion.
- Traffic Prediction: Uses Random Forest Regressor to predict bus counts based on historical traffic data
- Graph-based Route Analysis: Implements NetworkX for modeling street networks and finding optimal paths
- Dynamic Vehicle Allocation: Allocates vehicles based on predicted congestion and road capacity
- Interactive Input System: User-friendly interface for route planning with date/time specifications
- Visualization: Network graphs showing traffic flow and vehicle allocation
The system uses Chicago Traffic Tracker historical congestion estimates by segment from 2018, containing:
- Segment IDs for road identification
- Date and time information
- Bus count data for traffic volume
- Street segment information (FROM_STREET, TO_STREET)
- Road length data for capacity calculations
- Python Libraries:
pandas
&numpy
- Data manipulation and analysisscikit-learn
- Machine learning models (Random Forest Regressor)NetworkX
- Graph creation and path analysismatplotlib
- Data visualizationdatetime
- Time-based calculations
- Data Preprocessing: Historical traffic data is cleaned and prepared
- Feature Engineering: Date conversion to ordinal format for model training
- Model Training: Random Forest Regressor learns patterns from historical data
- Graph Construction: Street network represented as nodes (intersections) and edges (road segments)
- Path Finding: Shortest path algorithms identify optimal routes
- Congestion Prediction: ML model predicts traffic for specific date/time
- Vehicle Allocation: Dynamic allocation based on predicted congestion and road capacity
The system tracks model accuracy using:
- RMSE (Root Mean Square Error): Measures prediction accuracy
- MAE (Mean Absolute Error): Average prediction deviation
- Input Collection: Users specify origin, destination, date, and time
- Path Analysis: System finds all shortest paths between locations
- Traffic Prediction: ML model predicts congestion for each road segment
- Allocation Calculation: Vehicles allocated based on:
- Predicted traffic volume
- Road segment length/capacity
- Time-based traffic patterns
- Visualization: Results displayed as network graphs with allocation data
- Public Transit Planning: Optimize bus routes and frequencies
- Emergency Services: Efficient ambulance and fire truck deployment
- Ride-sharing: Dynamic vehicle positioning for services like Uber/Lyft
- City Planning: Data-driven decisions for traffic infrastructure
- Logistics: Delivery vehicle routing optimization
The system provides an interactive interface where users can:
- Enter starting and destination locations
- Specify travel date (year, month, day)
- Select time slot (24-hour format with hourly intervals)
- View predicted congestion and optimal vehicle allocation
- Real-time data integration
- Multi-modal transportation support
- Weather impact modeling
- Mobile application development
- Integration with city traffic management systems
This project demonstrates the practical application of machine learning in urban transportation systems. The combination of predictive modeling and graph algorithms provides a robust foundation for intelligent traffic management solutions.