Related Experiment Video
Updated: Aug 30, 2026

Implementation of a Real-Time Psychosis Risk Detection and Alerting System Based on Electronic Health Records using CogStack
Published on: May 15, 2020
Building an early warning model for the risk of suicide attempt in people with depression based on machine learning:
Mian Zhang1,2,3, Wen Liu4, Wenzhi Pei4
1School of Mental Health and Psychological Science, Anhui Medical University, Hefei, China.
Background:
Attempted suicide is one of the most serious clinical consequences for patients with depression, and early identification of high-risk individuals is crucial for preventing suicide deaths. Traditional clinical assessment often relies on subjective judgment, lacking objective biological markers and multi-dimensional data integration analysis.
Objective:
This study aims to use machine learning algorithms to integrate demographic characteristics, clinical symptom scales, and blood biochemical indicators to construct and validate an early warning model for the risk of attempted suicide in patients with depression, and to explore key predictors.
Methods:
A total of 1,229 patients with depression were included in this study, including 578 cases in the suicide attempt group and 651 cases in the non-suicide attempt group. Demographic information, Hamilton Depression Scale (HAMD) sub-item scores, and biochemical indicators such as thyroid function, liver and kidney function, blood lipids, and electrolytes were collected. Predictive models were constructed using six machine learning algorithms: Random Forest (RF), Extreme Gradient Boost (XGBoost), Support Vector machine (SVM), multi-layer perceptron (MLP), logistic regression (LR), and Decision tree (DT). Model performance was evaluated by area (AUC) under the receiver operating characteristic curve (ROC), accuracy, sensitivity, specificity, and F1 score, and feature importance was explained by SHAP (Shapley Additive exPlanations) values.
Results:
Univariate analysis showed significant differences (P<0.05) between the two groups in terms of gender, education level, free triiodothyronine (FT3), albumin, triglycerides, blood potassium, social dysfunction, cognitive impairment, sense of hopelessness, and mental anxiety. In the comparison of model performance, random forest (RF) performed the best, with an AUC of 0.675 (95% CI: 0.621-0.727), outperforming other models. Feature importance analysis indicated that age of onset (AOO), body mass index (BMI), free thyroxine (FT3), and uric acid (UA) were core predictor variables consistent across models. The SHAP analysis further revealed that advanced age, low education level, high mental symptom markers, high cognitive impairment scores, and high uric acid levels significantly increased the risk of attempted suicide, while higher FT3 levels might have a protective effect.
Conclusion:
This study successfully constructed an early warning model for the risk of suicide attempt in patients with depression based on multimodal data. The random forest model demonstrated good predictive performance. The study found that in addition to traditional psychosocial factors, metabolic indicators such as BMI and uric acid and thyroid function (FT3) are also important risk predictors, providing a new biological perspective for early clinical intervention.