Objective:To construct and determine the optimal prediction model for osteoporosis (OP) in patients with type 2 diabetes mellitus (T2DM) by using machine learning methods based on body composition data and metabolic indicators.Methods:This was a cross-sectional study that consecutively enrolled T2DM patients hospitalized in the Department of Endocrinology at the First Affiliated Hospital of Soochow University from October 2021 to March 2026. Clinical data on age, sex, uric acid, free triiodothyronine (FT
3), and total procollagen type Ⅰ N-terminal propeptide (P1NP), muscle mass, fat mass, and basal metabolic rate were collected. Based on bone mineral density, the patients were divided into a T2DM with OP group (DOP group, T-score≤-2.5) and a T2DM without OP group (NOP group, T-score>-2.5). The data were randomly split into a training set and an internal validation set at an 8∶2 ratio. Nine machine learning models [multivariate logistic regression, support vector machine, K-nearest neighbors, Gaussian naive Bayes, multilayer perceptron, random forest, decision tree, extreme gradient boosting, and light gradient boosting machine (LGBM) ] were constructed and compared. The receiver operating characteristic (ROC) curve was used to evaluate model discrimination, and the area under the curve (AUC), sensitivity, and specificity were calculated. Decision curve analysis (DCA) was employed to assess clinical usefulness. SHapley Additive exPlanations (SHAP) analysis was used to determine the importance of the variables included in the optimal model.
Results:A total of 1 213 T2DM patients were enrolled, including 412 in the DOP group and 801 in the NOP group. Compared with the NOP group, the DOP group had a higher proportion of women, older age, lower muscle mass and uric acid levels, and higher levels of P1NP and FT
3 (
P<0.05). Among the nine machine learning models, the LGBM model had the best overall performance. In the training set, the AUC was 0.883 (95%CI 0.861-0.904), the sensitivity was 0.829, and the specificity was 0.798. In the validation set, the AUC was 0.860 (95%CI 0.812-0.907), the sensitivity was 0.753, and the specificity was 0.817, with good clinical net benefit on decision curve analysis. SHAP analysis showed that basal metabolic rate, FT
3, age, P1NP, and fat mass were the top five most important predictive factors.
Conclusion:Among the prediction models constructed using different machine learning algorithms, the model based on the LGBM algorithm had the highest performance in predicting OP in T2DM patients.