RI
ritesh-begin/Traffic_prediction
This is the Traffic Analysis and Prediction based project from RandomForest Classifier.
๐ฆ Traffic Data Analysis & Prediction
๐ Introduction
This project focuses on analyzing traffic data collected over a span of two months. Using data visualization and machine learning models, the goal is to uncover traffic patterns and build predictive models to better understand situation and traffic density.
๐ฏ Objectives
- Perform exploratory data analysis (EDA) on traffic data.
- Visualize patterns with Matplotlib, Seaborn, and Plotly.
- Apply feature preprocessing (scaling, encoding).
- Train regression models (RandomForest Classifier) to predict traffic values.
- Evaluate model performance with accuracy_score metrics.
๐ Dataset
- File Used:
TrafficTwoMonth.csv - The dataset contains traffic-related information including:
- Hourly data
- Vehicle counts (car, bus, truck, bike and total)
- Traffic situation categories
- Other feature like Time of that particular date is present.
๐ ๏ธ Tools & Libraries
- Python
- Pandas & NumPy โ Data manipulation & analysis
- Matplotlib & Seaborn โ Normal visualizations
- Plotly โ Interactive visualizations
- Scikit-learn โ Data preprocessing, RandomForest Classifier, pipelines , ColumnTransformer
๐ Exploratory Data Analysis
- Initial data inspection (
head(),info(),describe()) - Traffic trend analysis across different hours and dates
- Distribution plots for vehicle counts
- Interactive plots for comparative analysis
๐ Visualizations
- Traffic patterns per weekend
- Count comparisons between different vehicle types per Hour
- Interactive hist plot for vehicles per hour for week days
- Line plot for average vehicle per hour
- Visualizations combining total trafffic by category
- Line plot for average vehicle accordance with the date of the month
๐ค Machine Learning Models
-
Preprocessing:
- Standard scaling
- One-hot encoding for categorical features
-
Models Used:
- Random Forest Classifier
-
Evaluation:
- Accuracy_score
- Classification_report
๐ Results
- RandomForest Classifier models provide an estimation of traffic levels.
- Visualization highlights peak hours and traffic conditions.
On this page
Contributors
Created August 19, 2025
Updated August 23, 2025