Skip to main content

Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

  • Review Article
  • Published:

A procedural overview of why, when and how to use machine learning for psychiatry

Abstract

Machine learning (ML) is becoming a tool of choice to analyze high-dimensional datasets pertaining to mental health. Given the rapid integration of ML into research and clinical settings, this article provides a functional overview of a common ML pipeline used for the assessment and prediction of psychiatric disorders. Developing such a construct entails building a data infrastructure, collecting and preprocessing data, training and testing models and interpreting their results. Practical considerations pertaining to data management and preprocessing are first presented. We then describe considerations and best practices for model selection on the basis of the psychiatric disorder and the data modalities available for analysis. A critical analysis of existing works utilizing ML methods for psychiatric disorder assessment, prediction and causal associations is also provided. Last, future ML trends in psychiatry are highlighted. To reinforce learning, the Supplementary Note links to an interactive Jupyter Notebook that offers practical examples and hands-on interaction with a sample dataset.

This is a preview of subscription content, access via your institution

Access options

Buy this article

USD 39.95

Prices may be subject to local taxes which are calculated during checkout

Fig. 1: The ML project life cycle consists of six stages and aims to develop an ML model that addresses the specific application needs.
Fig. 2: Artificial and convolutional neural network architectures.
Fig. 3: Two-dimension convolution between a kernel operator and an input image.
Fig. 4: Simple machine learning models.
Fig. 5: Area under the receiver operating characteristic curve allows a way to compare the performance of different ML methods.
Fig. 6: Contour plot of a Gaussian mixture model with three Gaussian components.
Fig. 7: Generative machine learning model architectures.

Similar content being viewed by others

References

  1. Kendler, K. S. The phenomenology of major depression and the representativeness and nature of DSM criteria. Am. J. Psychiatry 173, 771–780 (2016).

    Article  PubMed  Google Scholar 

  2. Cai, N. et al. Minimal phenotyping yields genome-wide association signals of low specificity for major depression. Nat. Genet. 52, 437–447 (2020).

    Article  PubMed  PubMed Central  Google Scholar 

  3. Monrad-krohn, G. H. Dysprosody or altered melody of language. Brain 70, 405–415 (1947).

    Article  PubMed  Google Scholar 

  4. Kraepelin, E. Manic-Depressive Insanity and Paranoia (E. & S. Livingstone, 1921).

  5. Wasserzug, Y. et al. Development and validation of a machine learning-based vocal predictive model for major depressive disorder. J. Affect. Disord. 325, 627–632 (2023).

    Article  PubMed  Google Scholar 

  6. Insel, T. Digital mental health care: five lessons from act 1 and a preview of acts 2–5. NPJ Digit. Med. 6, 1–3 (2023).

    Article  Google Scholar 

  7. Sequeira, L. et al. Mobile and wearable technology for monitoring depressive symptoms in children and adolescents: a scoping review. J. Affect. Disord. 265, 314–324 (2020).

    Article  PubMed  Google Scholar 

  8. Yarkoni, T. & Westfall, J. Choosing prediction over explanation in psychology: lessons from machine learning. Perspect. Psychol. Sci. 12, 1100–1122 (2017).

    Article  PubMed  PubMed Central  Google Scholar 

  9. Shmueli, G. To explain or to predict? Stat. Sci. 25, 289 – 310 (2010).

    Article  Google Scholar 

  10. Nobile, M. et al. The influence of family structure, the TPH2 G-703T and the 5-HTTLPR serotonergic genes upon affective problems in children aged 10–14 years. J. Child Psychol. Psychiatry 50, 317–325 (2009).

    Article  PubMed  Google Scholar 

  11. Marino, C. et al. No evidence for association and linkage disequilibrium between dyslexia and markers of four dopamine-related genes. Eur. Child Adolesc. Psychiatry 12, 198–202 (2003).

    Article  PubMed  Google Scholar 

  12. Spatola, C. A. M. et al. Gene–environment interactions in panic disorder and CO2 sensitivity: effects of events occurring early in life. Am. J. Med. Genet. B 156B, 79–88 (2011).

    Article  Google Scholar 

  13. Breiman, L. Statistical modeling: the two cultures (with comments and a rejoinder by the author). Stat. Sci. 16, 199–231 (2001).

    Article  Google Scholar 

  14. Rajula, H. S. R., Verlato, G., Manchia, M., Antonucci, N. & Fanos, V. Comparison of conventional statistical methods with machine learning in medicine: diagnosis, drug development, and treatment. Medicina 56, 455 (2020).

    Article  PubMed  PubMed Central  Google Scholar 

  15. Iyortsuun, N. K., Kim, S. H., Jhon, M., Yang, H. J. & Pant, S. A review of machine learning and deep learning approaches on mental health diagnosis. Healthcare 11, 285 (2023).

    Article  PubMed  PubMed Central  Google Scholar 

  16. Amann, J. et al. Explainability for artificial intelligence in healthcare: a multidisciplinary perspective. BMC Med. Inform. Decis. Mak. 20, 310 (2020).

    Article  PubMed  PubMed Central  Google Scholar 

  17. Adadi, A. & Berrada, M. in Embedded Systems and Artificial Intelligence (eds Bhateja, V. et al.) 327–337 (Springer, 2020); https://doi.org/10.1007/978-981-15-0947-6_31

  18. Vyas, D. A., Eisenstein, L. G. & Jones, D. S. Hidden in plain sight: reconsidering the use of race correction in clinical algorithms. N. Engl. J. Med. 383, 874–882 (2020).

    Article  PubMed  Google Scholar 

  19. Glaz, A. L. et al. Machine learning and natural language processing in mental health: systematic review. J. Med. Internet Res. 23, e15708 (2021).

    Article  PubMed  PubMed Central  Google Scholar 

  20. Zantvoort, K., Scharfenberger, J., Boß, L., Lehr, D. & Funk, B. Finding the best match—a case study on the (text-)feature and model choice in digital mental health interventions. J. Healthc. Inform. Res. 7, 447–479 (2023).

    Article  PubMed  PubMed Central  Google Scholar 

  21. Shatte, A. B., Hutchinson, D. M. & Teague, S. J. Machine learning in mental health: a scoping review of methods and applications. Psychol. Med. 49, 1426–1448 (2019).

    Article  PubMed  Google Scholar 

  22. Dwyer, D. B., Falkai, P. & Koutsouleris, N. Machine learning approaches for clinical psychology and psychiatry. Annu. Rev. Clin. Psychol. 14, 91–118 (2018).

    Article  PubMed  Google Scholar 

  23. Manan, S. & Seneviratne, O. MentalHealthAI: Utilizing personal health device data to optimize psychiatry treatment. AMIA Annu. Symp. Proc. 2023, 641–652 (2024).

    Google Scholar 

  24. Davenport, T. & Kalakota, R. The potential for artificial intelligence in healthcare. Future Healthc. J. 6, 94–98 (2019).

    Article  PubMed  PubMed Central  Google Scholar 

  25. Bishop, C. M. Pattern Recognition and Machine Learning 1st edn (Springer, 2006).

  26. Minaeva, O. et al. Screening for depression in daily life: development and external validation of a prediction model based on actigraphy and experience sampling method. J. Med. Internet Res. 22, e22634 (2020).

    Article  PubMed  PubMed Central  Google Scholar 

  27. Volkers, A. C. et al. Motor activity and autonomic cardiac functioning in major depressive disorder. J. Affect. Disord. 76, 23–30 (2003).

    Article  PubMed  Google Scholar 

  28. Finazzi, M. et al. Motor activity and depression severity in adolescent outpatients. Neuropsychobiology 61, 33–40 (2009).

    Article  PubMed  Google Scholar 

  29. Komorowski, M., Marshall, D. C., Salciccioli, J. D. & Crutain, Y. in Secondary Analysis of Electronic Health Records 185–203 (Springer, 2016); https://doi.org/10.1007/978-3-319-43742-2_15

  30. Verma, A. A. et al. Implementing machine learning in medicine. CMAJ 193, E1351–E1357 (2021).

    Article  PubMed  PubMed Central  Google Scholar 

  31. Software as a Medical Device (SaMD) (FDA, 2018); https://www.fda.gov/medical-devices/digital-health-center-excellence/software-medical-device-samd

  32. Zhang, A., Xing, L., Zou, J. & Wu, J. C. Shifting machine learning for healthcare from development to deployment and from models to data. Nat. Biomed. Eng. 6, 1330–1345 (2022).

    Article  PubMed  Google Scholar 

  33. Murdoch, B. Privacy and artificial intelligence: challenges for protecting health information in a new era. BMC Med. Ethics 22, 122 (2021).

    Article  PubMed  PubMed Central  Google Scholar 

  34. Rajkomar, A., Dean, J. & Kohane, I. Machine learning in medicine. N. Engl. J. Med. 380, 1347–1358 (2019).

    Article  PubMed  Google Scholar 

  35. Yan, W.-J., Ruan, Q.-N. & Jiang, K. Challenges for artificial intelligence in recognizing mental disorders. Diagnostics 13, 2 (2022).

    Article  PubMed  PubMed Central  Google Scholar 

  36. Starke, G., Schmidt, B. S., De Clercq, E. & Elger, B. S. Explainability as fig leaf? An exploration of experts’ ethical expectations towards machine learning in psychiatry. AI Ethics 3, 303–314 (2023).

    Article  Google Scholar 

  37. Chandler, C., Foltz, P. W. & Elvevåg, B. Using machine learning in psychiatry: the need to establish a framework that nurtures trustworthiness. Schizophr. Bull. 46, 11–14 (2019).

    PubMed Central  Google Scholar 

  38. Ronneberger, O., Fischer, P. & Brox, T. In Medical Image Computing and Computer-Assisted Intervention (eds Navab, N. et al.) 234–241 (Springer, 2015).

  39. Vaswani, A. et al. Attention is all you need. Adv. Neural Inf. Proc. Syst. 30, 1–11 (2017).

    Google Scholar 

  40. Solenov, D., Brieler, J. & Scherrer, J. The potential of quantum computing and machine learning to advance clinical research and change the practice of medicine. MO Med. 115, 463–467 (2018).

    PubMed  PubMed Central  Google Scholar 

  41. Lu, J. et al. Prediction of depression severity based on transformer encoder and CNN model. In Proc. 2022 13th International Symposium on Chinese Spoken Language Processing (ISCSLP) 339–343 (IEEE, 2022).

  42. Gour, N. et al. Transformers for autonomous recognition of psychiatric dysfunction via raw and imbalanced EEG signals. Brain Inform. 10, 25 (2023).

    Article  PubMed  PubMed Central  Google Scholar 

  43. Wang, J. et al. Unobtrusive health monitoring in private spaces: the smart home. Sensors 21, 864 (2021).

    Article  PubMed  PubMed Central  Google Scholar 

  44. Zanardi, R. et al. Precision psychiatry in clinical practice. Int. J. Psychiatry Clin. Pract. 25, 19–27 (2021).

    Article  PubMed  Google Scholar 

  45. Welch, V. et al. Use of mobile and wearable artificial intelligence in child and adolescent psychiatry: scoping review. J. Med. Internet Res. 24, e33560 (2022).

    Article  PubMed  PubMed Central  Google Scholar 

  46. Masdeu, J. C. Neuroimaging in psychiatric disorders. Neurotherapeutics 8, 93–102 (2011).

    Article  PubMed  PubMed Central  Google Scholar 

Download references

Acknowledgments

We acknowledge the Canadian Institutes of Health Research (CIHR) and the Natural Sciences and Engineering Research Council (NSERC) for providing funding for this work and the Centre for Addiction and Mental Health (CAMH) for providing resources that helped inform the writing of this article.‘deep learning.’

Author information

Authors and Affiliations

Authors

Contributions

C.L. contributed to the writing of the ‘ML in mental healthcare’, ‘ML in healthcare settings’ and ‘Data-based learning tools’ sections, and the Supplementary Information. He also co-developed the Jupyter Notebook, contributed to the revisions and organized the contributions of the other authors. M.A. contributed to the writing of the ‘ML in mental healthcare’, ‘ML in healthcare settings’ and ‘Outlook’ sections, and the Supplementary Information. T.P. contributed to the writing of the ‘ML in mental healthcare’, ‘ML in healthcare settings’ and ‘Outlook’ sections, and the Supplementary Information. He also co-developed the Jupyter Notebook and aided in revising various manuscript drafts. D.K. contributed the figures and provided major edits throughout the document. P.S. and J.S. contributed to drafting the manuscript and provided insights in the review process. M.B. contributed to the conceptualization and drafting of the manuscript and critically reviewed it throughout the review process.

Corresponding author

Correspondence to Christopher Lucasius.

Ethics declarations

Competing interests

The authors declare no competing interests.

Peer review

Peer review information

Nature Mental Health thanks Peter Falkai, Manpreet Singh and the other, anonymous, reviewer(s) for their contribution to the peer review of this work.

Additional information

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

Supplementary information

Supplementary Information

Supplementary Figs. 1–8, Table 1 and Discussion.

Supplementary Note

Interactive Jupyter Notebook.

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

Lucasius, C., Ali, M., Patel, T. et al. A procedural overview of why, when and how to use machine learning for psychiatry. Nat. Mental Health 3, 8–18 (2025). https://doi.org/10.1038/s44220-024-00367-2

Download citation

  • Received:

  • Accepted:

  • Published:

  • Version of record:

  • Issue date:

  • DOI: https://doi.org/10.1038/s44220-024-00367-2

This article is cited by

Search

Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing