Skip to main content


Log in

Application of machine learning algorithms to predict osteoporosis in postmenopausal women with type 2 diabetes mellitus

  • Original Article
  • Published:
Journal of Endocrinological Investigation Aims and scope Submit manuscript



The screening and diagnosis of osteoporosis in patients with type 2 diabetes mellitus (T2DM) based on bone mineral density remains challenging because of the limited availability and accessibility of dual-energy X-ray absorptiometry. We aimed to develop and validate models to predict the risk of osteoporosis in postmenopausal women with T2DM based on machine learning (ML) algorithms.


This retrospective study included 303 postmenopausal women with T2DM. To develop prediction models for osteoporosis, we applied nine ML algorithms combined with demographic, clinical, and laboratory data. The least absolute shrinkage and selection operator were used to perform feature selection. We used the bootstrap resampling technique for model training and validation. To test the performance of the models, we calculated indices including the area under the receiver operating characteristic curve (AUROC), accuracy, sensitivity, specificity, positive predictive value, negative predictive value, F1 score, calibration curve, and decision curve analysis. Furthermore, we conducted fivefold cross-validation for parameter optimization and model validation. Feature importance was assessed using the SHapley additive explanation (SHAP).


We identified 10 independent predictors as the most valuable features. An AUROC of 0.616–1.000 was observed for nine ML algorithms. The extreme gradient boosting (XGBoost) model exhibited the best performance, outperforming conventional risk assessment tools and registering 0.993 in the training set, 0.798 in the validation set, and 0.786 in the test set for fivefold cross-validation. Using SHAP, we found that the explanatory variables contributed to the model and their relationship with osteoporosis occurrence. Furthermore, we developed a user-friendly tool for calculating the risk of osteoporosis.


With the integration of demographic and clinical risk factors, ML algorithms can accurately predict osteoporosis. The XGBoost model showed ideal performance. With the incorporation of these models in the clinic, patients may benefit from early osteoporosis diagnosis and treatment.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5

Similar content being viewed by others

Data availability

Some or all of the datasets generated and/or analyzed in the current study are not publicly available, but are available on reasonable request by the relevant authors.


  1. Valderrabano RJ, Linares MI (2018) Diabetes mellitus and bone health: epidemiology, etiology and implications for fracture risk stratification. Clin Diabetes Endocrinol 4(9):1.

    Article  Google Scholar 

  2. Hofbauer LC, Busse B, Eastell R, Ferrari S, Frost M, Muller R, Burden AM, Rivadeneira F, Napoli N, Rauner M (2022) Bone fragility in diabetes: novel concepts and clinical implications. Lancet Diabetes Endocrinol 10(3):207–220.

    Article  PubMed  Google Scholar 

  3. Greenhill C (2018) Shared variants for osteoporosis and T2DM. Nat Rev Endocrinol 14(11):627.

    Article  PubMed  Google Scholar 

  4. Camacho PM, Petak SM, Binkley N, Diab DL, Eldeiry LS, Farooki A, Harris ST, Hurley DL, Kelly J, Lewiecki EM, Pessah-Pollack R, McClung M, Wimalawansa SJ, Watts NB (2020) American Association of Clinical Endocrinologists/American College of endocrinology clinical practice guidelines for the diagnosis and treatment of postmenopausal osteoporosis-2020 update. Endocr Pract 26(Suppl 1):1–46.

    Article  PubMed  Google Scholar 

  5. Choksi P, Jepsen KJ, Clines GA (2018) The challenges of diagnosing osteoporosis and the limitations of currently available tools. Clin Diabetes Endocrinol 4(12):1.

    Article  Google Scholar 

  6. Sheu A, Greenfield JR, White CP, Center JR (2022) Assessment and treatment of osteoporosis and fractures in type 2 diabetes. Trends Endocrinol Metab 33(5):333–344.

    Article  CAS  PubMed  Google Scholar 

  7. Goswami R, Nair A (2019) Diabetes mellitus, vitamin D and osteoporosis: insights. Indian J Med Res 150(5):425–428.

    Article  PubMed  PubMed Central  Google Scholar 

  8. Khosla S, Melton LJ 3rd (2007) Clinical practice. Osteopenia N Engl J Med 356(22):2293–2300.

    Article  CAS  PubMed  Google Scholar 

  9. Toh LS, Lai PSM, Wu DB, Bell BG, Dang CPL, Low BY, Wong KT, Guglielmi G, Anderson C (2019) A comparison of 6 osteoporosis risk assessment tools among postmenopausal women in Kuala Lumpur. Malaysia Osteoporos Sarcopenia 5(3):87–93.

    Article  PubMed  Google Scholar 

  10. Ho-Pham LT, Doan MC, Van LH, Nguyen TV (2020) Development of a model for identification of individuals with high risk of osteoporosis. Arch Osteoporos 15(1):111.

    Article  PubMed  Google Scholar 

  11. Benke K, Benke G (2018) Artificial intelligence and big data in public health. Int J Environ Res Public Health 15(12):1.

    Article  Google Scholar 

  12. Obermeyer Z, Emanuel EJ (2016) Predicting the future—big data, machine learning, and clinical medicine. N Engl J Med 375(13):1216–1219.

    Article  PubMed  PubMed Central  Google Scholar 

  13. Shim JG, Kim DW, Ryu KH, Cho EA, Ahn JH, Kim JI, Lee SH (2020) Application of machine learning approaches for osteoporosis risk prediction in postmenopausal women. Arch Osteoporos 15(1):169.

    Article  PubMed  Google Scholar 

  14. Park HW, Jung H, Back KY, Choi HJ, Ryu KS, Cha HS, Lee EK, Hong AR, Hwangbo Y (2021) Application of machine learning to identify clinically meaningful risk group for osteoporosis in individuals under the recommended age for dual-energy X-ray absorptiometry. Calcif Tissue Int 109(6):645–655.

    Article  CAS  PubMed  Google Scholar 

  15. Ou Yang WY, Lai CC, Tsou MT, Hwang LC (2021) Development of machine learning models for prediction of osteoporosis from clinical health examination data. Int J Environ Res Public Health 18(14):1.

    Article  CAS  Google Scholar 

  16. Yoo TK, Kim SK, Kim DW, Choi JY, Lee WH, Oh E, Park EC (2013) Osteoporosis risk prediction for bone mineral density assessment of postmenopausal women using machine learning. Yonsei Med J 54(6):1321–1330.

    Article  PubMed  PubMed Central  Google Scholar 

  17. Wang Y, Wang L, Sun Y, Wu M, Ma Y, Yang L, Meng C, Zhong L, Hossain MA, Peng B (2021) Prediction model for the risk of osteoporosis incorporating factors of disease history and living habits in physical examination of population in Chongqing, Southwest China: based on artificial neural network. BMC Public Health 21(1):991.

    Article  PubMed  PubMed Central  Google Scholar 

  18. Chin KY, Ng BN, Rostam MKI, Muhammad Fadzil NFD, Raman V, Mohamed Yunus F, Syed Hashim SA, Ekeuku SO (2022) A mini review on osteoporosis: from biology to pharmacological management of bone loss. J Clin Med 11(21):1.

    Article  CAS  Google Scholar 

  19. Zhang W, Gao R, Rong X, Zhu S, Cui Y, Liu H, Li M (2022) Immunoporosis: role of immune system in the pathophysiology of different types of osteoporosis. Front Endocrinol (Lausanne) 13:965258.

    Article  PubMed  Google Scholar 

  20. Lorenzo J (2020) Cytokines and bone: osteoimmunology. Handb Exp Pharmacol 262:177–230.

    Article  CAS  PubMed  Google Scholar 

  21. Donath MY, Shoelson SE (2011) Type 2 diabetes as an inflammatory disease. Nat Rev Immunol 11(2):98–107.

    Article  CAS  PubMed  Google Scholar 

  22. Sowers MR, La Pietra MT (1995) Menopause: its epidemiology and potential association with chronic diseases. Epidemiol Rev 17(2):287–302.

    Article  CAS  PubMed  Google Scholar 

  23. Drouin P, Blickle JF, Charbonnel B, Eschwege E, Guillausseau PJ, Plouin PF, Daninos JM, Balarac N, Sauvanet JP (1999) Diagnosis and classification of diabetes mellitus: the new criteria. Diabetes Metab 25(1):72–83

    CAS  PubMed  Google Scholar 

  24. Levey AS, Bosch JP, Lewis JB, Greene T, Rogers N, Roth D (1999) A more accurate method to estimate glomerular filtration rate from serum creatinine: a new prediction equation: modification of Diet in Renal Disease Study Group. Ann Intern Med 130(6):461–470.

    Article  CAS  PubMed  Google Scholar 

  25. Consensus development conference (1993) diagnosis, prophylaxis, and treatment of osteoporosis. Am J Med 94(6):646–650.

    Article  Google Scholar 

  26. Chiu A, Ayub M, Dive C, Brady G, Miller CJ (2017) twoddpcr: an R/Bioconductor package and Shiny app for Droplet Digital PCR analysis. Bioinformatics 33(17):2743–2745.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  27. Wang C, Zhang T, Wang P, Liu X, Zheng L, Miao L, Zhou D, Zhang Y, Hu Y, Yin H, Jiang Q, Jin H, Sun J (2021) Bone metabolic biomarker-based diagnosis of type 2 diabetes osteoporosis by support vector machine. Ann Transl Med 9(4):316.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  28. Meng J, Sun N, Chen Y, Li Z, Cui X, Fan J, Cao H, Zheng W, Jin Q, Jiang L, Zhu W (2019) Artificial neural network optimizes self-examination of osteoporosis risk in women. J Int Med Res 47(7):3088–3098.

    Article  PubMed  PubMed Central  Google Scholar 

  29. Shaabanpour Aghamaleki F, Mollashahi B, Nosrati M, Moradi A, Sheikhpour M, Movafagh A (2019) Application of an artificial neural network in the diagnosis of chronic lymphocytic leukemia. Cureus 11(2):e4004.

    Article  PubMed  PubMed Central  Google Scholar 

  30. Smets J, Shevroja E, Hugle T, Leslie WD, Hans D (2021) Machine learning solutions for osteoporosis—a review. J Bone Miner Res 36(5):833–851.

    Article  PubMed  Google Scholar 

  31. Raisz LG (2005) Clinical practice: screening for osteoporosis. N Engl J Med 353(2):164–171.

    Article  CAS  PubMed  Google Scholar 

  32. Walsh JS, Vilaca T (2017) Obesity, type 2 diabetes and bone in adults. Calcif Tissue Int 100(5):528–535.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  33. Fassio A, Idolazzi L, Rossini M, Gatti D, Adami G, Giollo A, Viapiana O (2018) The obesity paradox and osteoporosis. Eat Weight Disord 23(3):293–302.

    Article  PubMed  Google Scholar 

  34. Zhang J, Li Y, Lai D, Lu D, Lan Z, Kang J, Xu Y, Cai S (2021) Vitamin D status is negatively related to insulin resistance and bone turnover in chinese non-osteoporosis patients with type 2 diabetes: a retrospective cross-section research. Front Public Health 9:727132.

    Article  PubMed  Google Scholar 

  35. Shanbhogue VV, Hansen S, Frost M, Jorgensen NR, Hermann AP, Henriksen JE, Brixen K (2016) Compromised cortical bone compartment in type 2 diabetes mellitus patients with microvascular disease. Eur J Endocrinol 174(2):115–124.

    Article  CAS  PubMed  Google Scholar 

  36. Chen J, Hendriks M, Chatzis A, Ramasamy SK, Kusumbe AP (2020) Bone vasculature and bone marrow vascular niches in health and disease. J Bone Miner Res 35(11):2103–2120.

    Article  CAS  PubMed  Google Scholar 

  37. Zhao Z (2018) Correlation analysis of urine proteins and inflammatory cytokines with osteoporosis in patients with diabetic nephropathy. J Musculoskelet Neuronal Interact 18(3):348–353

    CAS  PubMed  PubMed Central  Google Scholar 

  38. Lee HS, Hwang JS (2020) Impact of type 2 diabetes mellitus and antidiabetic medications on bone metabolism. Curr Diab Rep 20(12):78.

    Article  PubMed  Google Scholar 

  39. Sun M, Yang J, Wang J, Hao T, Jiang D, Bao G, Liu G (2016) TNF-alpha is upregulated in T2DM patients with fracture and promotes the apoptosis of osteoblast cells in vitro in the presence of high glucose. Cytokine 80:35–42.

    Article  CAS  PubMed  Google Scholar 

Download references


This work is supported by the the Extreme Smart Analysis platform ( and EmpowerStats ( Thanks are also extended to Bullet Edits Company for professional language improvement.


This study was supported by the Youth Science and technology project, Hebei Medical Science Research Project (20211155).

Author information

Authors and Affiliations



XW and FZ designed the study. AC and JW collected the data. XW and FZ analyzed the data. XW wrote and edited the article. YG improved the English language. JZ revised the article for intellectual content.

Corresponding author

Correspondence to X. Wu.

Ethics declarations

Conflict of interest

The authors declare no competing interests.

Consent to participate

Written informed consent for participation was waived by the Ethics Committee of Cangzhou Central Hospital.

Consent for publication

All of the authors approved the publication of the article.

Ethical approval

This study was approved by the Ethics Committee of Cangzhou Central Hospital.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Supplementary Information

Below is the link to the electronic supplementary material.

Supplementary file1 (DOCX 17 kb)

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Wu, X., Zhai, F., Chang, A. et al. Application of machine learning algorithms to predict osteoporosis in postmenopausal women with type 2 diabetes mellitus. J Endocrinol Invest 46, 2535–2546 (2023).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: