Back to research and writing

Research / Artificial Intelligence

/Machine Learning · Explainable AI

Smartphone Addiction Detection Using Random Forest and SHAP Explainability

An investigation into behavioral smartphone usage patterns, supervised classification, and explainable machine learning, with an emphasis on interpreting model predictions responsibly.

Authors

Bobby · Yogesh

B.Tech, Computer Science Engineering

Institution

CT Group of Institutions

Jalandhar, Punjab, India

Research guidance

Dr. Ankita Gupta

Project supervisor

Dataset

50,000 records

Input features

16 reported

Classifiers

03 evaluated

Interpretability

SHAP

01

Abstract

Research overview

Smartphones are deeply integrated into everyday life, but some usage patterns may indicate difficulty controlling phone use. This project investigates a machine learning approach to classifying behavioral patterns associated with problematic smartphone use using a dataset described as containing 50,000 user records.

The workflow constructs a target label using weighted behavioral rules, derives additional features, and compares Logistic Regression, Random Forest, and Gradient Boosting. SHAP is then used to examine the contribution of individual features to model predictions. In the reported analysis, Screen-to-Sleep Ratio has the highest mean absolute SHAP value.

Keywords

Digital wellness · Smartphone usage · Random Forest · Gradient Boosting · SHAP · Feature engineering · Explainable AI

02

Research motivation

Understanding behavior beyond screen time

Total screen time alone does not fully describe a person's relationship with a smartphone.

Heavy smartphone use and problematic use are not necessarily the same. Behavioral patterns involving sleep, stress, productivity, and social media may provide additional context for studying phone habits.

This project explores whether these signals can be combined into a classification pipeline and whether explainability methods can make the resulting predictions easier to interpret.

A

Behavioral signals

Study phone use alongside sleep, stress, and productivity.

B

Feature engineering

Represent relationships between measurements, not just isolated values.

C

Interpretability

Explore which input features influence model predictions.

03

Methodology

From raw data to model interpretation

The reported workflow combines label construction, feature engineering, preprocessing, model training, and explainability.

01

Dataset preparation

The project describes 50,000 user records containing demographic, occupational, device, and behavioral variables. User_ID is excluded from model inputs.

02

Rule-based label construction

A weighted behavioral score is calculated from predefined thresholds. Records with a total score of five or more receive the Is_Addicted label.

03

Feature engineering

Four additional features are derived: Screen-to-Sleep Ratio, Social Media Ratio, Productivity-Stress Gap, and Total Screen Time.

04

Preprocessing and data split

Categorical inputs are label-encoded. The reported workflow uses an 80/20 stratified train-test split with random_state 42.

05

Model training

Logistic Regression serves as a baseline, alongside Random Forest with 100 trees and Gradient Boosting with 100 estimators.

06

Model interpretation

TreeExplainer is used to calculate SHAP values for a sample of 1,000 test records from the Random Forest model.

Derived feature

Screen-to-Sleep Ratio

Daily_Phone_Hours / Sleep_Hours

This feature represents the relationship between daily phone use and sleep duration. It is an engineered model input, not a validated clinical diagnostic threshold. Records with zero or missing sleep duration also require appropriate handling during feature construction.

04

Experimental results

Comparing the classifiers

The figures below reproduce the accuracy values reported in the supplied project code.

Random Forest accuracy

99.39%

Reported classification accuracy

Gradient Boosting accuracy

99.48%

Highest reported accuracy among the three models

Classification accuracy

Reported test-set results

Scale: 0–100%
0255075100Logistic Regression88.82%Random Forest99.39%Gradient Boosting99.48%Accuracy in percent

Figure 1.Comparison of the three classifiers using the accuracy figures reported in the project. High accuracy should be interpreted in light of the rule-generated target labels and does not establish clinical validity.

Interpretation and evaluation caveat

The target labels were generated from behavioral scoring rules. Tree-based models may learn patterns closely related to those rules, resulting in very high accuracy. These figures alone do not establish clinical validity, diagnostic accuracy, or generalization to independently labeled populations.

05

Explainable AI

What influenced the predictions?

SHAP values provide a framework for examining how model inputs contribute to individual predictions and global model behavior.

Global feature importance

Mean absolute SHAP values for the reported Random Forest analysis

01Screen-to-Sleep Ratio
0.147
02Stress Level
0.124
03Daily Phone Hours
0.103
04Sleep Hours
0.101
05Social Media Hours
0.062
06Total Screen Time
0.049
07Productivity-Stress Gap
0.046
08Weekend Screen Time
0.044

Figure 2.Feature importance values transcribed from the reported analysis and scaled visually against the largest listed value. These values describe model attribution, not causal effects.

In the reported analysis, Screen-to-Sleep Ratio ranks first, followed by Stress Level, Daily Phone Hours, and Sleep Hours. This indicates that the first feature has the largest mean absolute SHAP value among the features listed.

Mean absolute SHAP values summarize the magnitude of feature contributions, not their direction. A larger value does not establish that a feature causes problematic smartphone use, nor does it validate the target labels.

06

Critical evaluation

Limitations and responsible use

The reported performance must be considered alongside the data-generation process and evaluation design.

01

Rule-generated target labels

The target is derived from a weighted behavioral score rather than independently verified clinical diagnoses. The models may reproduce the scoring rules used to create the labels.

02

Independent validation

Evaluation on independently labeled data is necessary to determine whether the observed performance generalizes beyond the target-generation rules.

03

Measurement quality

Self-reported stress and productivity measurements may contain recall and reporting bias. The supplied page does not establish independent verification of these measures.

04

Temporal and population generalization

The reported workflow does not by itself demonstrate that the model generalizes across different populations or captures changes in behavior over time.

05

Evaluation transparency

Accuracy should be accompanied by confusion matrices, precision, recall, F1-score, class distributions, and leakage checks for a more complete assessment.

07

Conclusion

Prediction is only part of the story

This project brings together behavioral feature engineering, supervised classification, and SHAP-based interpretation in a single machine learning workflow. The reported analysis identifies Screen-to-Sleep Ratio as the leading feature by mean absolute SHAP value in the Random Forest model.

The next important step is independent evaluation using appropriately labeled data, additional performance metrics, and rigorous leakage checks. Such evaluation would help determine whether the observed patterns generalize beyond the rules used to construct the target variable.

Project implementation

Digital Addiction Detection

Explore the implementation, project files, and model workflow in the source repository.

Explore source code
08

Bibliography

References and further reading

Selected publications relevant to smartphone-use assessment, ensemble learning, and explainable machine learning.

Bibliographic details and the relationship of each publication to the project should be verified against the original sources before formal academic submission.