Statistical analysis and Machine Learning prediction of sleep quality based on lifestyle and health data.
This project combines statistical analysis and Machine Learning to study and predict sleep quality from a dataset of 374 individuals.
It follows a structured methodology inspired by CRISP-DM and covers the full data science pipeline — from descriptive statistics to predictive modeling.
- Explore and understand sleep health data
- Perform descriptive statistical analysis (mean, variance, confidence intervals)
- Apply hypothesis testing
- Build and evaluate ML classification models to predict sleep quality
- Interpret results and extract meaningful insights
sleep-health-statistics/
│
├── data/ # Raw dataset + extracted columns
├── notebooks/ # Jupyter notebooks (stats + ML)
├── machine_learning/ # ML models and results
├── requirements.txt # Dependencies
└── README.md
Variable studied: Sleep Duration (hours/day)
| Statistic | Value |
|---|---|
| Min | 5.8h |
| Max | 8.5h |
| Mean | 7.13h |
| Variance | 0.63 |
| Std Dev | 0.80h |
| CI 95% | [7.05 , 7.21] |
| CI 98% | [7.03 , 7.23] |
Hypothesis Test (t-test):
- H0: mean = 7h → Rejected (p = 0.0014 < 0.05)
- Conclusion: individuals sleep significantly more than 7h on average
Can we predict sleep quality from lifestyle and physiological features?
Type: Multi-class classification (Poor / Average / Good)
- Data Cleaning — handling missing values in
Sleep Disorder - Feature Engineering — creating
Sleep_Quality_Categoryfrom score - Outlier Detection — IQR method (15 outliers in Heart Rate, kept)
- Encoding — One-Hot Encoding for categorical variables
- Normalization — StandardScaler on numerical features
- Train/Test Split — 80% train / 20% test (stratified)
| Metric | Score |
|---|---|
| Accuracy | 98.67% |
| Precision (avg) | 0.99 |
| Recall (avg) | 0.99 |
| F1-score (avg) | 0.99 |
Key findings:
AverageandGoodclasses predicted with near-perfect accuracyPoorclass correctly identified despite being underrepresented- Very few misclassifications confirmed by the confusion matrix
BENZHIR Wafa — Bachelor's student in Data Science & Intelligent Systems
Project completed as part of the Statistiques Avancées module 🎓 Academic year: 2025–2026