Building a Mental Health Prediction System with Machine Learning, SHAP & Flask
说明与用途
构建了一个使用AdaBoost、PHQ‑9、SHAP和Flask的心理健康风险评估Web应用,使用Docker容器化并实现自动监控部署。
问题
Develop an end‑to‑end mental‑health assessment tool that combines ML risk prediction, PHQ‑9 screening, explainability, and a web interface, moving beyond a notebook experiment.
结果
The project delivers a deployable mental‑health risk assessment web app with explainable predictions, PHQ‑9 integration, and support features, demonstrating a complete ML lifecycle from data to production.
工作流
- Collect and preprocess PHQ‑9 data
- Train multiple classifiers (AdaBoost, Random Forest, XGBoost, Logistic Regression)
- Select AdaBoost (≈86.9% accuracy)
- Serialize model, transformer, and encoder
- Build Flask backend with Gunicorn
- Create HTML/CSS/Bootstrap frontend with Jinja2 templates
- Integrate SHAP to generate feature‑contribution plots
- Add counseling booking and crisis assistance pages
- Containerize app with Docker
- Deploy to Render via GitHub Actions
- Set up automated uptime monitoring
证据
After tuning and evaluation, the AdaBoost classifier achieved approximately 86.9% accuracy and was selected as the final model.
The application generates visual explanations showing how individual features contributed to a particular prediction.
The project also contains serialized ML artifacts such as the trained model, preprocessing transformer and label encoder.
- 记录日期: 2026-09-07T04:07:26.542Z