# Predicting Road Accident Severity
This is a project which I built while collaborating with Omdena Kenya local chapter. My task was to build a machine learning web app and deploy a machine learning model for predicting road accidents.
## Project Goals
* This project aims to leverage machine learning (ML) techniques to analyze and predict road accidents in Kenya.
* Analyze and understand the patterns and contributing factors of accidents on Kenyan roads using * historical accident data.
* Identify accident-prone areas (hotspots) by analyzing accidents' spatial and temporal patterns.
* Develop a machine learning model to predict the severity of accidents based on various factors such as road conditions, weather, time of day, and vehicle types.
## Requirements
* pandas
* numpy
* plotly
* matplotlib
* seaborn
* scikit-learn
* notebook
* flask
## Run
To run the project you need to install the dependencies using `pip install -r requirements.txt`
This is going to build the OmdenaKenyaRoadAccidents package in your local machine.
There are 5 major components:
* DataIngestion class
* DataTransformation class
* ModelTrainer class
* train_pipeline function
* PredictPipeline class
These components are used to download the data from Google drive, apply preprocessing, add a machine learning model and then make predictions from the form input coming from the web app.
The DataIngestion class `initiate_data_ingestion` method is used to download the data from Google drive. This method takes one argument `id` which is the file id of the data to be downloaded. The downloaded file is the split into a train and test data set, with the test data being 20% of the original dataset. The datasets are stored in the artifacts directory.
#### data ingestion example
```python
from OmdenaKenyaRoadAccidents.components.data_ingestion import DataIngestion
id = "sYHT1jdjdieiW?ejieX3"
data_ingestion = DataIngestion()
train_path, test_path = data_ingestion.initiate_data_ingestion(id=id)
```
The …