Predicting Distracted Driving
Using Machine Learning and Sensor Data to Detect Distracted Driving for a Mobile Safety App
Problem Statement
Copernicus, a startup focused on mobile safety innovations, approached us with a unique challenge: could we detect whether a person texting on their iPhone was the driver or a passenger? Their goal was to develop an iOS keyboard that would notify users—or their parents—if someone was texting while driving. The core technical hurdle was distinguishing driver activity from passenger behavior using only sensor data captured during texting.
Situation
Summary
Marketing Science partnered with Copernicus to build a machine learning model that could detect whether someone texting on their phone was a driver or a passenger using keystroke and motion sensor data. The resulting decision tree model achieved 98% accuracy, enabling real-time distracted driving detection and laying the foundation for a safety-focused mobile keyboard app.
Key results
- Achieved 98% accuracy in detecting driver vs. passenger texting behavior using a custom decision tree model.
- Enabled real-time, sensor-driven distracted driving detection, supporting the launch of a safety-focused mobile keyboard app.
Solution
With structured data in place, we explored feature engineering by calculating averages and variances in yaw, pitch, roll, and typing speed for each sentence. These features were then used to build two machine learning models: a decision tree and a logistic regression classifier. This dual-model approach allowed us to compare accuracy and interpretability, and to evaluate whether an ensemble method might further improve performance.
The decision tree model used features such as char_count, time_delta, yaw_ave, roll_ave, pitch_ave, yaw_var, pitch_var, roll_var, speed_ave, and a binary label (driver vs. passenger). This approach enabled transparent, rule-based classification tailored to user behavior.
Results
The decision tree model achieved 98% accuracy, outperforming the logistic regression model at 95% accuracy. Based on this performance, we recommended that Copernicus move forward with the decision tree model while continuing to retrain and refine it as more user data becomes available.
Decision Tree model generated from trained data