Traffic Accident Analysis.
From raw records to tested classifiers ↘A comparative ML study of road-accident outcomes in Rawalpindi.
A phased machine-learning project based on road traffic accident data from Rawalpindi, Punjab, Pakistan. It investigates two possible classification targets—injury type and patient status—through preprocessing, logistic regression, decision trees, SVMs and ensemble models, with accuracy and class-aware evaluation.
The problem, and the approach.
What needed solving?
Accident records contain heterogeneous variables and two potentially distinct prediction targets. Comparing classifiers meaningfully requires preprocessing, controlled train/test evaluation, consistent metrics and hyperparameter diagnostics, not just training one high-capacity model.
What was built?
Organize the work into four project phases: preprocess; establish logistic regression baseline; compare tree and margin-based models; then evaluate Random Forest, XGBoost and AdaBoost, using precision, recall, F1, confusion matrices and accuracy.
Architecture, without the noise.
This is a simplified conceptual diagram of the components documented in the repository; it is not a claim that all operations use a single synchronous pipeline.
Road-traffic records from Rawalpindi / Punjab.
Clean, transform and prepare features and targets.
Logistic Regression plus solver / max_iter sensitivity.
Decision Tree and SVM model comparisons.
Random Forest, XGBoost and AdaBoost.
Accuracy, precision, recall, F1, confusion matrix and learning curves.
How it works, step by step.
- 01
Phase 1 — data preparation
Explore and preprocess the road traffic accident dataset before modelling.
phase 1 - 02
Phase 2 — linear baseline
Fit and evaluate logistic regression for both targets, varying solver and max_iter and inspecting performance curves.
phase 2 - 03
Phase 3 — nonlinear comparison
Train Decision Tree and SVM; vary max_depth and kernel, then compare with the logistic regression baseline.
phase 3 - 04
Phase 4 — ensembles
Train Random Forest, XGBoost and AdaBoost and add results to the same comparison framework.
phase 4 - 05
Report target-specific metrics
For injury type and patient status, examine accuracy, precision, recall, F1 and confusion matrices to avoid using only one score.
The choices behind the system.
Separate classification targets
Injury type and patient status are evaluated as distinct prediction problems; their classes and costs need not align.
Baseline before ensembles
A simple logistic regression baseline helps contextualize later model complexity.
Inspect hyperparameter sensitivity
The assignment includes solver/iteration curves, tree-depth curves and kernel comparisons.
Inside the implementation.
Model comparison design
Linear
Logistic regression sweeps the documented solvers: lbfgs, liblinear, newton_cg, newton-cholesky, sag and saga.
Tree and margin models
Decision-tree depths from 4–9 and SVM kernels linear, poly, rbf and sigmoid are compared.
Ensembles
Random Forest, XGBoost and AdaBoost are added in Phase 4 as higher-capacity baselines.
Evaluation consistency
Accuracy, precision, recall, F1 and confusion matrix are the shared reports across phases.
Documented experimental grid
The README specifies these hyperparameter ranges and algorithms. This is a compact description of the study design, not a verbatim source-code function.
PHASE 2 LogisticRegression
solvers: lbfgs, liblinear, newton_cg,
newton-cholesky, sag, saga
max_iter: 50, 100, 150, 200, 250, 300
PHASE 3 DecisionTree(max_depth=4..9)
SVM(kernel=linear|poly|rbf|sigmoid)
PHASE 4 RandomForest, XGBoost, AdaBoost
EVALUATE accuracy, precision, recall, F1,
confusion matrix [each target]SOURCE REFERENCE / README.md · Project PhasesResults in context.
What the repository supports
The public README details the modelling phases, algorithm families, hyperparameter options and planned comparison metrics, but it does not include a reproducible numerical results table. The portfolio does not present an invented accuracy or a “best model” ranking.
Numbers here are reported by the project author in the linked public repository or CV. They are not independent tests performed for this portfolio.
Trade-offs & open questions.
No aggregate accuracy in the README
The public overview lists evaluation methods but not numerical model scores; inspect the notebook outputs for reproducible comparisons.
Avoid target leakage
It is important to verify preprocessing and encoding were fitted on train splits only; the README alone cannot establish this.
Local rather than global population
Predictions trained on Rawalpindi incident records may not generalize to other road networks or reporting regimes.
Associations, not causation
Model feature correlations must not be presented as causes of severe injury without a causal design.
Source directory.
These source paths are identified in the project implementation or accompanying documentation. Links open the corresponding GitHub source location; availability can change as repositories evolve.