ENGINEERING NOTEBOOK / CLASSICAL MACHINE LEARNING / 07

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.

Machine-learning coursework / comparative study Source-grounded technical notes
FIG 07 · SYSTEM SKETCH
2prediction targetsInjury type and patient status
6documented model families
4project phases
01
WHY THIS EXISTS

The problem, and the approach.

CHALLENGE

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.

DIRECTION

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.

TECHNICAL TOOLKIT
Pythonscikit-learnLogistic RegressionDecision TreeSVMRandom ForestXGBoostAdaBoostClassification Metrics
02
SYSTEM DESIGN

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.

FIG. 07 / SYSTEM FLOW
01 / STAGEAccident dataset

Road-traffic records from Rawalpindi / Punjab.

02 / STAGEPreprocessing

Clean, transform and prepare features and targets.

03 / STAGEBaseline

Logistic Regression plus solver / max_iter sensitivity.

04 / STAGEAlternative learners

Decision Tree and SVM model comparisons.

05 / STAGEEnsembles

Random Forest, XGBoost and AdaBoost.

06 / STAGEReporting

Accuracy, precision, recall, F1, confusion matrix and learning curves.

Source: https://github.com/cRED-f/traffic-accident-analysis-punjab-pakistan · Architecture summarized from repository implementation and documentation.
03
RUNBOOK

How it works, step by step.

  1. 01

    Phase 1 — data preparation

    Explore and preprocess the road traffic accident dataset before modelling.

    phase 1
  2. 02

    Phase 2 — linear baseline

    Fit and evaluate logistic regression for both targets, varying solver and max_iter and inspecting performance curves.

    phase 2
  3. 03

    Phase 3 — nonlinear comparison

    Train Decision Tree and SVM; vary max_depth and kernel, then compare with the logistic regression baseline.

    phase 3
  4. 04

    Phase 4 — ensembles

    Train Random Forest, XGBoost and AdaBoost and add results to the same comparison framework.

    phase 4
  5. 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.

04
ENGINEERING THINKING

The choices behind the system.

NOTE 01

Separate classification targets

Injury type and patient status are evaluated as distinct prediction problems; their classes and costs need not align.

NOTE 02

Baseline before ensembles

A simple logistic regression baseline helps contextualize later model complexity.

NOTE 03

Inspect hyperparameter sensitivity

The assignment includes solver/iteration curves, tree-depth curves and kernel comparisons.

05
TECHNICAL DETAILS

Inside the implementation.

Model comparison design

01

Linear

Logistic regression sweeps the documented solvers: lbfgs, liblinear, newton_cg, newton-cholesky, sag and saga.

02

Tree and margin models

Decision-tree depths from 4–9 and SVM kernels linear, poly, rbf and sigmoid are compared.

03

Ensembles

Random Forest, XGBoost and AdaBoost are added in Phase 4 as higher-capacity baselines.

04

Evaluation consistency

Accuracy, precision, recall, F1 and confusion matrix are the shared reports across phases.

DOCUMENTED CONFIGURATIONREADME · experiment design

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 Phases
06
MEASURED EVIDENCE

Results 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.

07
ENGINEERING HONESTY

Trade-offs & open questions.

01

No aggregate accuracy in the README

The public overview lists evaluation methods but not numerical model scores; inspect the notebook outputs for reproducible comparisons.

02

Avoid target leakage

It is important to verify preprocessing and encoding were fitted on train splits only; the README alone cannot establish this.

03

Local rather than global population

Predictions trained on Rawalpindi incident records may not generalize to other road networks or reporting regimes.

04

Associations, not causation

Model feature correlations must not be presented as causes of severe injury without a causal design.

08
READ THE CODE

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.