Abstract
Digital behavior data derived from social media and online engagement offer new opportunities for computational mental well-being assessment, yet many existing prediction systems remain difficult to interpret and provide limited support for actionable intervention. In this study, we propose an explainable and prescriptive machine learning framework for emotion-aware digital mental well-being decision support, aligned with the goals of biomedical informatics and computer-based health support systems. The framework uses structured behavioral features, including age, platform type, daily usage time, posting activity, likes, comments, and messages, to classify seven emotional well-being states: Aggression, Anger, Anxiety, Boredom, Happiness, Neutral, and Sadness.
We developed an optimized Random Forest classifier as the predictive core, achieving 98% overall accuracy on the study dataset. To improve transparency and support interpretability in high-stakes health-related analytics, the framework integrates LIME and SHAP to provide local and global explanations of model behavior. We further incorporated a DiCE-based counterfactual module to identify minimal behavior changes associated with transitions from negative emotional states toward more stable or positive states. We operationalized these outputs through an agent-assisted recommendation layer that generates real-time, rule-based behavioral guidance.
The proposed framework advances beyond conventional black-box classification by combining prediction, interpretability, recourse generation, and decision support within a unified computational pipeline. The results indicate that structured digital-behavior features can support accurate emotion-aware well-being modeling, while the explainability and counterfactual components improve transparency and practical usability. This work contributes a deployable biomedical informatics framework for digital mental well-being monitoring and personalized behavioral support.
Overview
An explainable, prescriptive machine learning framework for digital mental well-being. It predicts a person's dominant emotional state from how they use social media, explains that prediction for the individual and across the whole dataset, finds the smallest behaviour changes that would move a negative state toward a positive or stable one, and turns the result into real-time guidance through a rule-based agent.
Key Contributions
- 1Optimised Random Forest classifier that separates seven emotional well-being states (Aggression, Anger, Anxiety, Boredom, Happiness, Neutral, Sadness) from seven behavioural and social media usage features.
- 2Dual explainability layer: LIME for instance-level reasoning behind each prediction and SHAP for global feature importance across the dataset.
- 3DiCE-based counterfactual module that finds the minimal behaviour changes needed to move from a negative state to Happiness or Neutral, under realistic constraints such as age only staying the same or rising.
- 4Agentic AI intervention module that turns predicted emotions and counterfactual suggestions into real-time, rule-based well-being recommendations.
- 5One deployable pipeline that joins prediction, explanation, counterfactual recourse and automated intervention for digital mental well-being decision support.
Figures



Methodology
Seven behavioural features (age, platform, daily usage time, and posts, likes, comments and messages per day) are used to predict a user's dominant emotion across seven classes. The platform is encoded as a number, and an ANOVA test confirms every feature is significant (p < 0.05), with likes and comments received showing the largest effect.
The classes were highly imbalanced, so Random Oversampling brought every class to 257 samples before a 60/40 train-test split. An optimised Random Forest is the predictive core. LIME explains individual predictions and SHAP gives global feature importance.
A DiCE counterfactual module then searches for the closest feature vector the model classifies as Happiness or Neutral, with every feature kept inside its range and age allowed only to stay the same or rise (up to 60). Finally, an Agentic AI module applies 15 decision rules on the predicted emotion, age, platform, usage and engagement to produce personalised recommendations through a simple input form.
Datasets
Social media usage records (age, platform, daily usage time, posts, likes, comments, messages) labelled with one of seven dominant emotions.
Results & Findings
The optimised Random Forest reached 0.98 overall accuracy on the 40% held-out test split, with per-class F1-scores between 0.96 and 1.00. ROC AUC was 1.000 for four of the seven classes and no lower than 0.995 for the rest, and average precision was close to 1.000 for every class. The calibration curves stayed close to the diagonal, with small deviations for Anxiety and Sadness, so the confidence scores are a reasonable input for the recommendation layer.
SHAP ranked comments received per day as the most influential feature overall, followed by daily usage time and likes received; platform and posts per day mattered least. The DiCE case studies gave concrete recourse: for example, a 33-year-old Instagram user predicted as Aggression reaches Neutral with fewer posts (6 to 1), fewer messages (29 to 19) and slightly less daily use (140 to 135 minutes). The agent module produced matching recommendations for all seven emotional states.
Conclusion
Structured social media behaviour can predict emotional well-being states accurately, and pairing the prediction with LIME and SHAP explanations, DiCE counterfactual recourse and a rule-based agent turns a black-box classifier into a transparent, prescriptive decision-support tool. Its outputs are decision-support insights, not clinical diagnoses. Future work targets larger, longitudinal and multi-modal datasets, causal explanations, and recommendations that adapt to user feedback.
Author Affiliations
- 1Department of Marketing, Operations, and Information Systems, College of Business, Abu Dhabi University, Abu Dhabi, United Arab Emirates
- 2Department of Computing and Information Technology, Gomal University, Dera Ismail Khan 29050, Pakistan
- 3Department of Computer Engineering, COMSATS University Islamabad, Sahiwal Campus, Sahiwal 57000, Pakistan
- 4Department of Computer Science, Virtual University of Pakistan, Lahore 51000, Pakistan