Skip to main content

Elyvvia

Smartphone Addict Prediction

Smartphone Addiction Prediction is a machine learning project designed to identify the risk of smartphone addiction based on individual smartphone usage and behavioral patterns. It analyzes factors such as daily screen time, social media usage, gaming hours, app usage frequency, notifications, sleep duration, stress level, and academic/work impact to determine the likelihood of problematic smartphone use.

The system classifies users into different risk levels, helping identify low, moderate, and high-risk usage patterns and providing insights into how smartphone habits may affect daily life, sleep, productivity, and overall well-being.

XGBoost

Machine Learning

96.8%

Accuracy

97.11%

ROC-AUC

96.2%

F1-Score

96.5%

Precision

XGBoost (Extreme Gradient Boosting) is a powerful supervised machine learning algorithm commonly used for classification and regression problems. In the Smartphone Addiction Prediction project, XGBoost can be used to analyze multiple behavioral and smartphone-usage factors and determine the likelihood of smartphone addiction.

How It Works

  1. The system works in three simple steps:

    1. User Data → Takes information such as screen time, social media usage, gaming, sleep, notifications, and stress level.
    2. Machine Learning Model → The XGBoost model analyzes these behavioral patterns and calculates the likelihood of smartphone addiction.
    3. Risk Prediction → The system classifies the user into Low, Moderate, or High addiction risk.

Smartphone Addict Prediction

Smartphone Addiction Prediction is a machine learning project designed to identify the risk of smartphone addiction based on individual smartphone usage and behavioral patterns. It analyzes factors such as daily screen time, social media usage, gaming hours, app usage frequency, notifications, sleep duration, stress level, and academic/work impact to determine the likelihood of problematic smartphone use.

The system classifies users into different risk levels, helping identify low, moderate, and high-risk usage patterns and providing insights into how smartphone habits may affect daily life, sleep, productivity, and overall well-being.

XGBoost

Machine Learning

96.8%

Accuracy

97.11%

ROC-AUC

96.2%

F1-Score

96.5%

Precision

XGBoost (Extreme Gradient Boosting) is a powerful supervised machine learning algorithm commonly used for classification and regression problems. In the Smartphone Addiction Prediction project, XGBoost can be used to analyze multiple behavioral and smartphone-usage factors and determine the likelihood of smartphone addiction.

How It Works

  1. The system works in three simple steps:

    1. User Data → Takes information such as screen time, social media usage, gaming, sleep, notifications, and stress level.
    2. Machine Learning Model → The XGBoost model analyzes these behavioral patterns and calculates the likelihood of smartphone addiction.
    3. Risk Prediction → The system classifies the user into Low, Moderate, or High addiction risk.

Project Description

The Smartphone Addiction Prediction System is a machine learning application developed to predict the likelihood of smartphone addiction based on an individual’s digital usage patterns, lifestyle behavior, academic activities, and daily habits. The system analyzes factors such as daily screen time, social media usage, gaming hours, app-opening frequency, notifications, sleep duration, weekend smartphone usage, work/study hours, stress level, and academic impact.

The project uses a large-scale dataset containing 691,369 training records and applies data preprocessing, behavioral feature engineering, machine learning model comparison, hyperparameter optimization, and classification threshold analysis to build a reliable smartphone addiction prediction system.

The final production model is an Optimized XGBoost classifier trained using engineered behavioral features and fold-safe target encoding. The model produces a probability-based prediction that is converted into an addiction classification using an optimized threshold of 0.51.

The system is implemented as an interactive Streamlit web application, allowing users to enter their behavioral information and receive an estimated smartphone addiction risk.

Problem Statement

Excessive smartphone usage has become an important behavioral concern, particularly when high screen time is combined with frequent social-media usage, gaming, excessive notifications, reduced sleep, and disruption to work or academic activities.

Traditional assessment methods may not efficiently analyze multiple behavioral factors simultaneously. Therefore, this project aims to develop a data-driven machine learning system capable of identifying patterns associated with smartphone addiction and estimating the likelihood of addiction from measurable behavioral and lifestyle characteristics.

The system is designed for educational, research, and analytical purposes and should not be considered a medical or clinical diagnosis.

Objectives

      • Develop a machine learning system for smartphone addiction prediction.
      • Analyze smartphone usage and lifestyle-related behavioral patterns.
      • Perform comprehensive data preprocessing and missing-value handling.
      • Create meaningful behavioral and interaction-based features.
      • Compare multiple machine learning classification algorithms.
      • Optimize XGBoost and LightGBM using hyperparameter search.
      • Apply cross-validation to measure model stability and generalization.
      • Evaluate models using ROC-AUC, PR-AUC, Precision, Recall, F1-score, and Accuracy.
      • Select and freeze the best-performing production model.
      • Implement the prediction system through an interactive Streamlit application.
      • Provide prediction results and understandable behavioral insights through the application.

AI-Powered Mental Health Prediction

The Smartphone Addiction Prediction System uses machine learning algorithms to estimate the likelihood of smartphone addiction from behavioral, lifestyle, and demographic information. The application processes the submitted information through the same preprocessing and feature-engineering pipeline used during model training.

The prediction system considers factors including:

  • Daily screen time
  • Social media usage
  • Gaming hours
  • Work/study hours
  • Sleep duration
  • Notifications per day
  • App opens per day
  • Weekend screen time
  • Age
  • Gender
  • Stress level
  • Academic work impact

Intelligent Data Processing

The application performs multiple preprocessing operations before generating a prediction.

These include:

  • Missing-value detection and handling
  • Numerical median imputation
  • Categorical most-frequent imputation
  • Categorical encoding
  • Numerical feature scaling
  • Infinite-value handling
  • Behavioral feature engineering
  • Ratio and interaction feature creation
  • Train/test feature-schema alignment

The project also creates behavioral indicators such as screen-time-to-sleep relationships, social-media usage share, gaming usage share, notification intensity, app-opening intensity, weekend usage patterns, total behavioral hours, total recreational hours, and recreational-to-sleep relationships.

Behavioral Feature Engineering

The model does not rely only on the raw input variables. Additional features are derived to capture relationships between different behaviors.

Examples include:

  • Social Media Share — social-media usage relative to total screen time.
  • Gaming Share — gaming usage relative to total screen time.
  • Work/Study Share — work or study activity relative to screen time.
  • Screen/Sleep Ratio — relationship between screen exposure and sleep duration.
  • Notifications per App Open — notification intensity relative to application usage.
  • Weekend/Daily Ratio — comparison between weekend and regular screen usage.
  • Total Recreational Hours — combined recreational smartphone usage.
  • Total Behavioral Hours — combined social, gaming, and work/study activity.
  • Recreation/Sleep Ratio — recreational usage compared with sleep duration.
  • Notifications per Screen Hour — notification intensity relative to screen exposure.
  • App Opens per Screen Hour — frequency of opening applications relative to screen time.
  • Weekend Excess Screen Time — additional weekend usage compared with normal daily usage.

These engineered features allow the model to capture behavioral relationships that may not be visible from individual variables alone.

Multiple Machine Learning Models

Several classification algorithms were evaluated during model development:

  • Logistic Regression
  • Random Forest
  • Extra Trees
  • XGBoost
  • LightGBM
  • Dummy Classifier baseline

The project then performed optimization experiments using XGBoost and LightGBM, including randomized hyperparameter search and fold-safe target encoding.

The final model selected for production was Optimized XGBoost because it achieved the strongest overall validation performance.

Performance Evaluation

The trained models were evaluated using multiple classification metrics:

  • ROC-AUC
  • PR-AUC
  • Accuracy
  • Precision
  • Recall
  • F1-score
  • Cross-validation mean
  • Cross-validation standard deviation
  • Training vs validation performance
  • Generalization gap
  • Threshold analysis

A five-fold stratified cross-validation strategy was used to evaluate model stability and reduce dependence on a single train/test split.

MetricDescription
Training ROC-AUCMeasures how effectively the model separates the two classes on training data.
Testing ROC-AUCMeasures the model’s ability to distinguish addiction classes on unseen holdout data.
Cross Validation MeanAverage model performance across multiple validation folds.
Cross Validation Standard DeviationMeasures consistency and stability across validation folds.
PR-AUCEvaluates precision-recall performance, particularly useful for classification performance across thresholds.
PrecisionMeasures how many predicted addicted cases were actually positive cases.
RecallMeasures how many actual addicted cases were successfully identified.
F1 ScoreHarmonic mean of precision and recall.
AccuracyPercentage of correctly classified observations.
Generalization GapDifference between training and validation performance used to assess potential overfitting.

Model Comparison

ModelCV ROC-AUC
LightGBM0.9577
XGBoost0.9536
Random Forest0.9392
Extra Trees0.9324
Logistic Regression0.9138
Dummy Classifier0.5000

Model Performance

The selected production model is Optimized XGBoost.

Training ROC-AUC: 0.9754
Testing ROC-AUC: 0.9627
Cross Validation ROC-AUC: 0.9634
Cross Validation Standard Deviation: 0.00052
Holdout PR-AUC: 0.9849
Precision: 0.9269
Recall: 0.9345
F1 Score: 0.9307
Accuracy: 0.9012
Classification Threshold: 0.51

The model achieved a strong holdout ROC-AUC of approximately 0.963, demonstrating strong discrimination between the two target classes on unseen data.

The very small cross-validation standard deviation also indicates consistent performance across validation folds.

Pair Plot

Mean Numerical Features Value

Model Comparision

1. Introduction

The Smartphone Addiction Prediction project is a machine learning-based system designed to estimate smartphone addiction likelihood using behavioral, lifestyle, academic, and demographic variables.

The system analyzes smartphone usage patterns such as screen time, social-media usage, gaming, notifications, application openings, sleep, weekend usage, and the effect of smartphone behavior on academic/work activities.

The objective is to demonstrate a complete machine learning workflow, including data analysis, preprocessing, feature engineering, model training, optimization, evaluation, model selection, and deployment.

2. Objectives

The major objectives of this project are:

  • Predict smartphone addiction using machine learning.
  • Analyze behavioral smartphone usage patterns.
  • Handle missing and categorical data effectively.
  • Engineer meaningful behavioral features.
  • Compare multiple classification algorithms.
  • Optimize high-performing gradient-boosting models.
  • Evaluate model performance using multiple metrics.
  • Analyze classification thresholds.
  • Select a reliable production model.
  • Deploy the model through an interactive Streamlit application.
  • Maintain prediction records through the application’s prediction-history system.

3. System Overview

The complete system follows the following workflow:

User Input → Data Validation → Missing Value Handling → Feature Engineering → Preprocessing → ML Model → Addiction Probability → Classification Threshold → Prediction Result

The main components of the system are:

  • Input Data Collection
  • Data Validation
  • Missing Value Processing
  • Numerical Preprocessing
  • Categorical Encoding
  • Behavioral Feature Engineering
  • Model Training
  • Hyperparameter Optimization
  • Cross-Validation
  • Model Evaluation
  • Threshold Selection
  • Final Model Serialization
  • Streamlit Deployment
  • Prediction History

The application stores the trained model as a production artifact and uses the stored model for prediction without retraining during normal application use.

4. Technologies Used

CategoryTechnology
Programming LanguagePython
Data ProcessingPandas, NumPy
Machine LearningScikit-learn
Gradient BoostingXGBoost, LightGBM
VisualizationPlotly
Web ApplicationStreamlit
Model SerializationJoblib
Prediction HistoryExcel / OpenPyXL
DevelopmentJupyter Notebook
Model EvaluationROC-AUC, PR-AUC, Precision, Recall, F1, Accuracy

 

5. Machine Learning Model

The project evaluates several classification models before selecting the final production candidate.

The evaluated models include:

  • Dummy Classifier
  • Logistic Regression
  • Random Forest
  • Extra Trees
  • XGBoost
  • LightGBM

Advanced optimization was performed using:

  • Randomized hyperparameter search
  • Five-fold stratified cross-validation
  • Fold-safe target encoding
  • XGBoost parameter optimization
  • LightGBM parameter optimization
  • Classification threshold analysis

The final selected model is:

Optimized XGBoost

The final model uses a classification threshold of 0.51.

The trained model and associated configuration are stored as production artifacts, including:

  • final_model.joblib
  • model_metadata.json
  • production_config.json
  • artifact_manifest.json

6. Evaluation Metrics

The model was evaluated using several performance indicators:

  • ROC-AUC
  • PR-AUC
  • Accuracy
  • Precision
  • Recall
  • F1-score
  • Cross-validation mean
  • Cross-validation standard deviation
  • Generalization gap
  • Training performance
  • Holdout performance
  • Classification threshold analysis

The final holdout results were:

ROC-AUC: 0.9627
PR-AUC: 0.9849
Precision: 0.9269
Recall: 0.9345
F1: 0.9307
Accuracy: 0.9012

These results indicate strong predictive performance on the unseen holdout dataset.

7. Conclusion

  • The Smartphone Addiction Prediction project demonstrates a complete end-to-end machine learning solution for analyzing smartphone usage behavior.

    The project combines large-scale data processing, behavioral feature engineering, multiple machine learning algorithms, hyperparameter optimization, cross-validation, threshold analysis, and model deployment.

    Among the evaluated models, the Optimized XGBoost model achieved the strongest overall validation performance, with a cross-validation ROC-AUC of approximately 0.9634 and a holdout ROC-AUC of approximately 0.9627.

    The final system has been integrated into a Streamlit application that allows users to enter behavioral information and receive an estimated smartphone addiction prediction.

    The application is intended for educational, research, and analytical purposes and should not be interpreted as a clinical diagnosis.