This project aims to predict the type of traffic accident using a supervised Neural Network (NN) model. The dataset contains nearly 60,000 accident records with driver, vehicle, road, environmental, temporal, and location-related features.
The primary goal is to build a generalizable classification model by applying proper preprocessing, feature engineering, and validation techniques while avoiding data leakage.
-
Size: 59,981 rows × 36 columns
-
Target Variable:
Accident Type -
Feature Types:
- Categorical (driver behavior, road condition, weather, vehicle type)
- Numerical (driver age, vehicle service year, number of vehicles)
- Temporal (hour, day, month)
- Spatial (location easting & northing)
The following analyses were performed:
- Histograms and boxplots for numerical feature distributions
- Count plots for categorical variables
- Target class distribution analysis
- Correlation analysis for numerical features
EDA helped identify skewness, outliers, and class imbalance.
Outcome-related variables (e.g., number of casualties, injuries, fatalities) were removed to prevent the model from learning information unavailable before an accident occurs.
-
Temporal Encoding
Hourencoded using sine and cosine to preserve cyclic behavior- Additional
Time_Bucketfeature created (Morning Rush, Midday, Evening Rush, Night)
-
Spatial Encoding
Location EastingandLocation Northingdiscretized into bins
-
Vehicle Age Grouping
- Vehicles categorized as
New,Mid, orOld
- Vehicles categorized as
-
Date Features
DateandYearremoved to avoid redundancy and leakage
- Target Variable: Label encoded
- Categorical Features: Encoded appropriately for NN input
- Numerical Features: Scaled for stable NN training
- Feedforward Neural Network
- Fully connected dense layers
- ReLU activation
- Softmax output layer for multi-class classification
- Loss Function: Sparse Categorical Crossentropy
- Optimizer: Adam
- Regularization: L2, Dropout, and Early Stopping
- Validation: Used to monitor overfitting and tune hyperparameters
- Training vs validation loss and accuracy monitoring
- Early stopping to prevent overfitting
- Performance evaluated on unseen data
- Overfitting prevention
- Cyclic feature encoding
- Label encoding vs one-hot encoding
- Validation-based model tuning
- Data leakage handling
- Python
- Pandas, NumPy
- Matplotlib, Seaborn
- Scikit-learn
- TensorFlow / Keras
- Jupyter Notebook
- Handle class imbalance using class weights or focal loss
- Try alternative models (XGBoost, Random Forest)
- Add SHAP or feature importance analysis
- Deploy model using a simple web interface
Yared Mengiste Software Engineering Student Neural Network & Data Analysis Project