/accident-severity-prediction

Predicting the severity of car accidents from various attributes

Primary LanguageJupyter Notebook

Accident Severity Prediction

GitHub license

About

Project Board, Current Issues, Assignment

Group 2 - Final Project for the UTK Machine Learning Course (COSC-522)

Libraries Overview

All the libraries are located under <project root>/project_libs

Where to put the code

The code is reloaded automatically. Any class object needs to reinitialized though.

Table of Contents

Prerequisites

You need to have a machine with Python >= 3.8 and any Bash based shell (e.g. zsh) installed. Having installed conda is also recommended.

$ python3.8 -V
Python 3.8

$ echo $SHELL
/usr/bin/zsh

Bootstrap Project

All the installation steps are being handled by the Makefile.

If you want to use conda run:

$ make install

$ conda activate accident_severity_prediction

If you want to use venv run:

$ make install env=venv

Using Git

To download the project:

  • If you have a ssh key saved in your GitHub account (instructions):
$ git clone git@github.com:UTK-ML-Dream-Team/accident-severity-prediction.git
  • If you haven't set up an ssh key:
$ git clone https://github.com/UTK-ML-Dream-Team/accident-severity-prediction.git

To push your local changes to remote repository:

  1. For every file you changed do:
$ git add path-to-file-1
$ git add path-to-file-2
# ...
  1. Create a commit message
$ git commit -m "My commit message"
  1. Push your changes to GitHub
$ git fetch
$ git pull
$ git push origin master

To pull changes from GitHub

$ git pull

Resolve conflicts:

# Install nbdime and run:
$ nbdime config-git --enable --global

Using Jupyter

Modifying the Configuration

You may need to configure the yml file. There is an already configured yml file under confs/prototype1.yml.

Local Jupyter

First, make sure you are in the correct virtual environment:

$ conda activate accident_severity_prediction

$ which python
/home/<your user>/anaconda3/envs/accident_severity_prediction/bin/python

To use jupyter, first run jupyter:

jupyter notebook

And open the main.ipynb.

Google Collab

Just Open this Google Collab Link.

Adding New Libraries

If you want to add a new library (e.g. a Class) in the project you need to follow these steps:

  1. Go to "<project root>/project_libs/project"
  2. Create a new python file inside it with a name like my_module.py
  3. Paste your code inside it
  4. Go to project_libs/project/init.py
  5. Add the following line: from project_libs.project/<Module name> import *
  6. (Optional) Rerun make install or python setup.py install

License

This project is licensed under the MIT License - see the LICENSE file for details.