This is a machine learning model that can detect dangerous driving using telematics data collected during the trip. More details about this project can be found at https://www.aiforsea.com/safety.
- Complete documentation of this project: documentation.ipynb
- Python library to predict dangerous driving: predict_model.py
- Pre-trained model weights directory: model_weights/
- Demonstratation of python library: demo.ipynb
- Reusable scripts (Model searching tools): utils.ipynb
- A total of 52 features are generated from raw telematics data using three approaches:
- Approach 1: Statistical summary of telematics data
- Approach 2: Count outlying driving behaviours based on telematics readings
- Approach 3: Sliding windows aggregated features
- Six blended (stacked) models are used in the prediction pipeline, which consists of 3 layers:
- Layer 1: 2 weak learners
- Layer 2: 3 strong learners
- Layer 3: 1 meta learner
- The model performance on self-define hold-out test dataset achieved:
- ROC Score: 0.7513
- Accuracy Score: 0.7853
NOTE: Please refer to documentation.ipynb for more details about this project.
(Tested on Python Version: 3.7)
First, clone the repository and install the dependencies.
git clone https://github.com/kfengtee/grab-aiforsea-safety.git
cd grab-aiforsea-safety
pip install -r requirements.txtThen, upload your hold-out test set (raw telematics data and labels) to this repository.
To use the library, you can do the following:
import predict_model
classifier = predict_model.DangerousDrivingClassifier('model_weights') # load the pre-trained weights
# replace "dir_to_raw_telematics_data" with actual hold-out test data directory
output = classifier.predict("dir_to_raw_telematics_data") # output: DataFrame, columns = ['bookingID', 'prob', 'label']Please look at demo.ipynb for more demonstration details.
MIT