NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Predicting involuntary admission following inpatient psychiatric treatment using machine learning trained on electronic health record data

Erik Perfalk, Jakob Grøhn Damgaard, Martin Bernstorff, Lasse Hansen, Andreas Aalkjær Danielsen, Søren Dinesen Østergaard

TL;DR

Researchers developed a machine learning model that uses routine electronic health record (EHR) data to predict involuntary psychiatric admissions up to six months after a voluntary discharge. Achieving an AUROC of 0.84, the study demonstrates that combining clinical notes with structured data can identify high-risk patients early enough to allow for preventive clinical interventions.

What Problem Does This Paper Address?

Involuntary psychiatric admissions—where a patient is hospitalized against their will because they are too ill to consent—are on the rise globally. These events are often traumatic for patients, damaging the therapeutic relationship and incurring high costs for healthcare systems.

The core challenge is that while clinicians know general risk factors (like a history of psychosis), assessing an individual’s risk in real-time is incredibly difficult. Clinical data is often "noisy," irregular, and buried in thousands of pages of free-text notes. Previous attempts to use machine learning in this space often focused on identifying risk factors rather than prospective prediction, or they relied on "clean" research data that doesn't reflect the messy reality of daily clinical practice. This paper seeks to provide a tool that can flag high-risk individuals at the moment they are discharged from a voluntary stay, creating a window for preventive care.

Methods

The researchers compared two primary approaches: XGBoost (a gradient boosting algorithm) and Elastic Net (regularized logistic regression). XGBoost was the clear winner, likely due to its ability to handle non-linear interactions and missing data—both common in EHRs.

The team engineered a massive set of 1,828 predictors. What sets this study apart is its dual-pronged approach to data:

  1. Structured Data: Traditional metrics like age, sex, ICD-10 diagnoses, medication history (ATC codes), and previous use of coercive measures (like restraints).
  2. Unstructured Text: They processed clinical notes using two Natural Language Processing (NLP) techniques: traditional TF-IDF to catch specific high-risk keywords and Sentence Transformers (specifically a multilingual MiniLM) to capture the semantic context of what doctors and nurses actually wrote.

The model was designed to issue a prediction at the "prediction time"—the day a patient is voluntarily discharged—looking ahead at a 180-day window.

Datasets

The study utilized the PSYCOP (PSYchiatric Clinical Outcome Prediction) cohort, which contains routine clinical EHR data from the Central Denmark Region.

  • Timeframe: 2013 to 2021.
  • Scale: 50,634 voluntary inpatient discharges across 17,968 unique patients.
  • Splitting: 85% for training/cross-validation and a 15% hold-out test set.

Crucially, the dataset reflects "real-world" conditions, meaning it includes patients with incomplete records, which is a major hurdle for clinical implementation.

Key Insights and Ideas

  • The "Clinical Story" is in the Text: 14 of the top 30 predictors came from unstructured clinical notes. Keywords like "police," "ECT" (electroconvulsive therapy), and "self-harm" provided critical context that structured diagnostic codes simply missed.
  • Diagnoses Aren't Enough: A model trained only on age, sex, and diagnoses performed poorly (AUROC 0.64). The jump to 0.84 with the full feature set proves that involuntary admission is a complex outcome driven by behavioral nuances and clinical history, not just a primary diagnosis.
  • A Wide Window for Prevention: The median time from the first high-risk prediction to the actual involuntary admission was 69.5 days. This is a "Goldilocks" window: it is long enough for a clinic to intervene (e.g., by creating crisis plans or increasing outpatient monitoring) but short enough to remain clinically urgent.
  • Stability Across Demographics: The model remained robust across different ages, sexes, and even different months of the year, suggesting it isn't over-relying on seasonal trends or specific demographic biases.

Key Results

  • Primary Metric: The best XGBoost model achieved an AUROC of 0.84 on the independent test set.
  • Clinical Utility: At a 5% "Predicted Positive Rate" (flagging the top 5% of highest-risk patients):
  • The model achieved a sensitivity of 39%, meaning it caught nearly 4 out of 10 future involuntary admissions.
  • The Positive Predictive Value (PPV) was 36%, meaning roughly one out of every three patients flagged would indeed face an involuntary admission within six months.
  • Benchmark: It significantly outperformed the baseline logistic regression and models trained on limited feature sets.

Limitations and Future Work

  • Generalizability: The model was trained on a specific healthcare system in Denmark. Because it relies heavily on Danish clinical notes, it would require significant retraining and translation to be used in other countries.
  • NLP Sophistication: The researchers used relatively "shallow" NLP methods. They suggest that future work using Large Language Models (LLMs) or domain-specific models like ClinicalBERT could unlock even more predictive power from the text.
  • Sequential Modeling: The current framework treats each discharge as a binary event. The authors note that moving toward sequential architectures (like Recurrent Neural Networks or Transformers) might better capture the "waxing and waning" of a patient's risk over their entire clinical history.

Summary updated

BibTeX
@inproceedings{perfalk2025predicting,
  author = {Erik Perfalk and Jakob Grøhn Damgaard and Martin Bernstorff and Lasse Hansen and Andreas Aalkjær Danielsen and Søren Dinesen Østergaard},
  title = {{Predicting involuntary admission following inpatient psychiatric treatment using machine learning trained on electronic health record data}},
  booktitle = {Biological},
  year = {2025},
  doi = {10.1016/j.biopsych.2025.02.047},
}
Figure