🚦 Accident Risk Intelligence System
“A Data Mining Approach for Predictive Safety Analytics &
Interactive Decision Support”
Data Mining Project Report
(24CAT-291)
Submitted by:
Jatin (24BCD10135
Meenal (24BCD10146)
Submitted To:
Mr. Kaushlendra Tiwari
(Assistant Professor)
Chandigarh University
UNIVERSITY INSTITUTE OF COMUTING
📌 Abstract
Road accidents are rarely the result of a single cause; rather, they emerge from the interaction of
multiple dynamic factors such as 🌦️ weather conditions, 🚗 traffic density, 🕒 time, and 🛣️ road
infrastructure.
This project introduces an Accident Risk Intelligence System that leverages machine learning
to predict accident risk levels based on these contextual inputs.
At its core, a Random Forest Classifier is utilized to capture complex, non-linear relationships
between features and classify risk into multiple levels. The system is further enhanced with an
interactive interface, allowing users to input real-world conditions and receive not only
predictions but also interpretable insights explaining the contributing factors.
The use of a synthetic dataset enables controlled experimentation, balanced data distribution,
and the simulation of diverse scenarios. Overall, the project demonstrates how data mining can
transform raw data into actionable safety intelligence.
📌 Problem Statement
Accident risk assessment is inherently complex due to the involvement of multiple interdependent
variables, including environmental conditions, traffic patterns, and road characteristics. Traditional
approaches primarily rely on historical analysis, lacking the ability to provide real- time
predictions or meaningful interpretability.
Furthermore, real-world datasets are often:
Incomplete or inconsistent
Imbalanced across risk categories
Restricted due to privacy concerns
These limitations create a need for a system that can effectively:
🔹 Predict accident risk under varying real-world conditions
🔹 Capture non-linear relationships between influencing factors
🔹 Provide interpretable outputs for better understanding
🔹 Operate through an interactive and user-friendly interface
UNIVERSITY INSTITUTE OF COMUTING
📌 💡 Proposed Solution
To address these challenges, this project proposes a machine learning-driven accident risk
prediction system that integrates predictive modeling with interpretability and user interaction.
🔧 Core Components of the Solution
🌳 Random Forest Classifier
Used to model complex, non-linear interactions between features such as weather, traffic,
time, and road type
🔢 Label Encoding
Converts categorical variables into a machine-readable format while maintaining
consistency
🖥️ Interactive User Interface (Gradio)
Enables real-time input and instant prediction in a structured and user-friendly manner
◻ Interpretability Layer
Provides context-aware explanations highlighting key factors influencing each prediction
📊 Correlation Heatmap Visualization
Offers analytical insights into relationships between features
📌 Dataset Design, Constraints & Justification
The dataset (accident_data.csv) used in this project is synthetically generated, which is a
deliberate and strategic design choice.
🔹 Why Synthetic Data?
Controlled Learning Environment: Enables precise definition of relationships (e.g., fog
+ highway → higher risk)
Balanced Risk Distribution: Prevents bias toward any particular risk class
Scenario Simulation: Allows testing of rare but critical conditions
Noise Reduction: Eliminates inconsistencies common in real-world datasets
UNIVERSITY INSTITUTE OF COMUTING
🔹 Justification for Limited Location Categories
The dataset contains a restricted set of location values, intentionally designed for:
Dimensional Control: Avoids excessive categorical expansion that may harm model
performance
Feature Isolation: Encourages the model to focus on dynamic risk factors (weather,
traffic, time)
Better Generalization: Prevents overfitting to location-specific patterns
Prototype Design: The system is built as a scalable model that can later incorporate real-
world geographic data
Thus, limited locations act as a controlled abstraction, not a limitation.
📌 Integrated Data Pipeline & Model Engineering
The system follows a pipeline-based architecture, ensuring consistency between training and
prediction stages.
🔹 Data Encoding Strategy
All categorical features are converted into numerical format using Label Encoding:
Ensures compatibility with machine learning algorithms
Maintains mapping for inverse transformation
Guarantees consistency between training and inference
🔹 Feature Configuration
Input Variables (X):
o Location
o Time
o Weather
o Traffic
o Road Type
Target Variable (y):
o Risk Level (Low / Medium / High)
UNIVERSITY INSTITUTE OF COMUTING
🔹 Model Selection: Random Forest Classifier 🌳
The system uses a Random Forest Classifier configured with:
200 trees
Maximum depth of 10
Fixed random state for reproducibility
🔹 Why Random Forest?
Captures non-linear relationships between variables
Handles categorical data effectively after encoding
Reduces overfitting through ensemble learning
Provides stable and reliable predictions
🔹 Prediction & Interpretability Layer
The system goes beyond prediction by incorporating an interpretability layer:
For each input:
1. Data is encoded
2. Model predicts:
o 🚨 Risk Level
o 📊 Probability Score
3. System generates context-aware explanations:
o Fog → low visibility
o High traffic → congestion risk
o Highway → speed-related risk
➡️ This transforms the system into a semi-explainable AI model.
UNIVERSITY INSTITUTE OF COMUTING
📌 System Output & Interpretive Analysis
A key strength of this project is its ability to present structured, human-readable outputs
rather than raw predictions.
🚦 Sample Prediction Scenario
Inputs:
📍 Location: Village Road Punjab
🕒 Time: Morning
🌫️ Weather: Foggy
🚗 Traffic: High
🛣️ Road Type: Highway
UNIVERSITY INSTITUTE OF COMUTING
📊 Prediction Output
🚨 Risk Level: HIGH
📈 Risk Score: 1.0
🗺️ Status: Accident Hotspot
⚠️ Key Contributing Factors
🌫️ Reduced visibility due to fog
🚗 Increased collision probability due to heavy traffic
🛣️ High-speed risk associated with highways
Insight Interpretation
This scenario reflects a compound risk condition, where multiple moderate factors interact to
produce a high-risk outcome.
Risk is not caused by a single factor but by the combined amplification of environmental,
traffic, and infrastructure conditions.
UNIVERSITY INSTITUTE OF COMUTING
🎯 Why This Output Design Matters
✅ Converts predictions into actionable insights
✅ Enhances usability for non-technical users
✅ Bridges gap between machine learning and real-world decision-making
📌 Visualization & Analytical Insights
The system includes a correlation heatmap for feature analysis.
📉 Key Observations from the Heatmap
Most correlation values are close to zero, indicating:
o Weak linear relationships between variables
o Features operate largely independently
🚗 Traffic vs Risk (~0.13):
o Shows the highest positive correlation with risk among all features
o Suggests that increased traffic contributes to higher accident probability
🌦️ Weather vs Risk (~0.06):
o Indicates a mild influence, meaning weather impacts risk but not strongly in a
linear way
🛣️ Road Type vs Risk (~ -0.04):
o Very weak relationship, implying its effect is context-dependent rather than
direct
📍 Location & Time:
o Almost negligible correlation with risk
o Confirms that these variables act more as contextual modifiers
UNIVERSITY INSTITUTE OF COMUTING
📌 User Interface & System Design
The system is implemented using Gradio, ensuring accessibility and interactivity.
🖥️ Interface Features
🎛️ Dropdown-based structured input
🚀 Real-time prediction
📋 Detailed output formatting
📊 On-demand heatmap generation
🖥️ Design Philosophy
The UI is designed to:
Minimize user error
Maximize interpretability
Provide a smooth interaction between user and model
UNIVERSITY INSTITUTE OF COMUTING
📌 System Workflow
📌 Feature Importance Analysis
Feature importance analysis helps identify how much each input variable contributes to the
model’s predictions. In this project, the Random Forest Classifier is used, which naturally ranks
features based on their impact on decision-making.
UNIVERSITY INSTITUTE OF COMUTING
importance = model.feature_importances_
features = [Link]
import pandas as pd
feat_imp = [Link](importance,
index=features).sort_values(ascending=False)
📊 Key Observations
🚗 Traffic shows the highest influence on accident risk
🌦️ Weather and 🛣️ Road Type have moderate impact
🕒 Time and 📍 Location contribute less directly
📊 Insight
Accident risk is influenced by combined feature effects, not a single dominant factor. Even
features with lower importance act as supporting variables in specific scenarios.
📌 Limitations & Critical Reflection
Synthetic data may not capture full real-world variability
Limited feature set (no driver behavior, vehicle type, etc.)
No real-time data integration
Encoded variables may simplify complex relationships
📌 Future Enhancements
🌐 Integration with real-world traffic datasets
📍 GPS-based live prediction
◻ Use of advanced models (XGBoost, Deep Learning)
🚨 Real-time accident alert system
🗺️ Geo-spatial hotspot mapping
UNIVERSITY INSTITUTE OF COMUTING
📌 Practical Applications
Smart traffic management systems
Accident hotspot detection
Driver safety awareness tools
Urban planning support
📌 Conclusion
This project demonstrates how data mining and machine learning can be used to build an
intelligent accident risk prediction system. By combining predictive modeling with interpretability
and visualization, the system moves beyond basic analytics into decision-support intelligence.
The use of synthetic data enables controlled experimentation, while the modular design ensures
scalability. With further enhancements, this system has the potential to evolve into a real-world
safety analytics solution.
📌 Learning Outcomes
📊 End-to-end machine learning pipeline development
◻ Understanding of feature interaction and risk modeling
🖥️ Building interactive ML applications
Q Importance of interpretability in AI systems
⚖️ Balancing data realism with experimental control
✨ Final Impact Statement
🚀 This project does not merely predict accident risk—it interprets it, explains it, and transforms
data into actionable intelligence, demonstrating the true potential of data mining in real-world
safety systems.
UNIVERSITY INSTITUTE OF COMUTING