← All work Research · Digital Phenotyping

Typing & Scrolling

Classifying fine-grained smartphone interaction states, such as typing and scrolling, directly from raw sensor streams, and predicting typing metrics from them with deep learning.

XGBoost LSTM scikit-learn · TensorFlow Sensor data Multi-rate

Summary

Knowing how a person physically interacts with their phone, not just which apps they open, is a useful signal for digital phenotyping. This project builds and benchmarks models that infer interaction states (typing, scrolling, other) from smartphone sensor data, and separately predict continuous typing metrics like keystroke count. It grew out of the behavioral-sensing work I did in wearables and mobile health.

What I built

  • Model comparison for classification. A head-to-head of Logistic Regression, Random Forest, SVM, KNN, Gradient Boosting, and XGBoost for activity classification, with cross-validation and saved models.
  • XGBoost across sampling rates. The best performer, trained and evaluated on datasets from 1 Hz up to 60 Hz, with stratified K-fold cross-validation, confusion matrices, and ROC-AUC curves at each rate.
  • LSTM for typing metrics. A deep sequence model that predicts typing speed, accuracy, or keystrokes from time-series sensor sequences, trained with 5-fold cross-validation.
  • Regression baselines. Linear Regression, Random Forest, Gradient Boosting, SVR, and KNN compared on MSE and MAE for the same prediction task.

Why it matters

The sampling-rate sweep matters for deployment: a model that is nearly as accurate at 2 Hz as at 60 Hz can run continuously on a phone without draining the battery. By identifying XGBoost as the best classifier and measuring the accuracy versus rate trade-off, the work points toward interaction-aware sensing that is cheap enough to run all day. That is the basis for using everyday phone behavior as a passive health signal.