Integrating Explainable Machine Learning and Mixed-Integer Optimization for Personalized Sleep Quality Intervention
Authors: Mahfuz Ahmed Anik, Mohsin Mahmud Topu, Azmine Toushik Wasi, Md Isfar Khan, MD Manjurul Ahsan
Organizations: Shahjalal University of Science and Technology, Sylhet, Bangladesh · Florida A&M University, Tallahassee, FL, United States · University of Oklahoma, Norman, OK, United States
Sleep quality is influenced by a complex interplay of behavioral, environmental, and psychosocial factors, yet most computational studies focus mainly on predictive risk identification rather than actionable intervention design. Although machine learning models can accurately predict subjective sleep outcomes, they rarely translate predictive insights into practical intervention strategies. To address this gap, we propose a personalized predictive-prescriptive framework that integrates interpretable machine learning with mixed-integer optimization. A supervised classifier trained on survey data predicts sleep quality, while SHAP-based feature attribution quantifies the influence of modifiable factors. These importance measures are incorporated into a mixed-integer optimization model that identifies minimal and feasible behavioral adjustments, while modelling resistance to change through a penalty mechanism. The framework achieves strong predictive performance, with a test F1-score of 0.9544 and an accuracy of 0.9366. Sensitivity and Pareto analyses reveal a clear trade-off between expected improvement and intervention intensity, with diminishing returns as additional changes are introduced. At the individual level, the model generates concise recommendations, often suggesting one or two high-impact behavioral adjustments and sometimes recommending no change when expected gains are minimal. By integrating prediction, explanation, and constrained optimization, this framework demonstrates how data-driven insights can be translated into structured and personalized decision support for sleep improvement.
Figures & tables
Figure 1: Generic sleep advice imposes high behavioral burden under real-world constraints, frequently resulting in poor follow-through and disrupted sleep. A minimal-change optimization framework instead delivers personalized, low-effort actions that promote more sustainable sleep improvement.
Figure 2: (a) Class distribution of sleep quality; (b) Sample counts for each sleep quality class after data augmentation.
Figure 3: Pearson correlation matrix of sleep quality and associated features
Table 1: Classification of variables by actionability and role in the framework
Model
Test F1
Accuracy
Precision
Recall
Val F1
Train F1
XGBoost
0.9544
0.9366
0.9468
0.9622
0.9579
0.9915
LightGBM
0.9526
0.9328
0.9282
0.9784
0.9630
0.9938
Gradient Boosting
0.9496
0.9291
0.9323
0.9676
0.9479
0.9954
Extra Trees
0.9476
0.9254
0.9188
0.9784
0.9524
0.9735
Random Forest
0.9455
0.9216
0.9100
0.9838
0.9430
0.9817
Neural Network (MLP)
0.8241
0.7388
0.7700
0.8865
0.8700
0.8458
Table 2: Performance metrics of evaluated machine learning models
Hyperparameter
Search Range
Selected Value
Number of trees ( n_estimators )
{50, 100}
100
Learning rate ( η )
{0.01, 0.05, 0.1}
0.05
Maximum depth ( max_depth )
{2, 3, 4}
3
Subsample ratio ( subsample )
{0.6, 0.8}
0.8
Column sample ratio ( colsample_bytree )
{0.6, 0.8}
0.8
Minimum child weight ( min_child_weight )
{3, 5}
3
Table 3: XGBoost hyperparameter configuration and search space
Figure 4: Mean absolute SHAP values for the XGBoost sleep quality prediction model. Higher values indicate features with greater influence on model predictions.
Figure 5: Overview of the proposed predictive–prescriptive framework. Survey data are preprocessed and used to train an XGBoost model for sleep quality prediction. SHAP-based analysis derives importance weights for actionable variables, which are incorporated into a constrained mixed-integer linear programming (MILP) model. The optimization produces personalized, feasible, and minimally disruptive sleep improvement recommendations.
Actionable Variable
Description
Mean Absolute SHAP Value ( wi )
Normalized Weight ( w~i )
Room cross-ventilation
Quality of air circulation in the sleeping environment
0.490
0.160
Nighttime quietness
Level of ambient noise during sleep
0.364
0.119
Lighting condition
Influence of lighting on sleep quality
0.354
0.116
Last caffeine intake time
Timing of last caffeine consumption before sleep
0.363
0.119
Sleeping posture
Quality of body posture during sleep
0.285
0.093
Screen use before sleep
Extent of screen exposure prior to bedtime
0.259
0.085
Table 4: SHAP-Derived Weights for Actionable Variables
λ Value
Interpretation
0.1
Low resistance to behavioral change
0.2
Moderate resistance to behavioral change
0.3
High resistance to behavioral change
Table 5: Behavioral Resistance Parameter Settings
Figure 6: Sensitivity and Pareto analysis of the optimization model. (a) Average number of recommended interventions decreases as the behavioral resistance parameter ( λ ) increases. (b) Pareto frontier between average expected benefit and intervention count, showing diminishing marginal gains as more interventions are applied.
Model Variant
Avg. Interventions
Avg. Benefit
Full Model
0.53
0.048
No Penalty ( λ=0 )
5.83
0.596
Equal Weights
5.83
5.830
Table 6: Ablation study comparison at λ=0.2
Actionable Variable
Baseline
Change
Optimized
Student 874
Screen use before sleep
0
+1
1
Consistent sleep schedule
3
0
3
Last caffeine intake time
4
0
4
Lighting condition
4
0
4
Room cross-ventilation
5
0
5
Table 7: Personalized intervention recommendations for representative students ( λ=0.2 ).
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
Symbol
Description
i
Index of actionable variables
n
Index of students
A
Set of actionable variables
N
Number of samples used for SHAP analysis
xi0
Baseline value of actionable variable i
Δxi
Decision variable representing change applied to i
Appendix
Table 8: List of symbols and notation used in this article