Martin Bernstorff
· 5 previous affiliations
- flowbaseSince 2026
- Full Stack Developer · Since 2026
- Aarhus University HospitalCurrent
- Current
- AI for cardiovascular disease and type 2 diabetes, Ph.D. · 2021–2024
- Trifork Digital Health2024–2026
- Back-end Developer · 2024–2026
- Aarhus University2014–2024
- PhD student · 2021–2024
- Master's degree, Medical Doctor · 2014–2021
- Research Year Student · 2020–2021
- Teaching Assistant, Biostatistics · 2019–2020
- Teaching Assistant, Epidemiology · 2018–2019
- Statistics in Medicine · 2015
Research Overview
Martin Bernstorff focuses on the development and validation of machine learning models using electronic health record (EHR) data, with a specific emphasis on psychiatric clinical outcomes and the integration of unstructured text. His work addresses the technical challenges of processing irregularly sampled medical time series and the methodological rigor required for Ensuring Prospective Utility in Medical Predictive Modeling. By bridging the gap between clinical narratives and structured data, Bernstorff’s research aims to provide actionable decision support for complex conditions, ranging from metabolic comorbidities in psychiatric patients to the progression of severe mental disorders.
Research Trajectory
Bernstorff’s early contributions focused on the foundational infrastructure and data stability necessary for large-scale clinical machine learning. In 2021, he participated in the establishment of The PSYchiatric clinical outcome prediction (PSYCOP) cohort: leveraging the potential of electronic health records in the treatment of mental disorders, a significant effort to organize representative datasets for precision psychiatry. This work set the stage for subsequent investigations into how clinical data evolves over time. A key concern in deploying longitudinal models is whether the underlying data generation process—specifically how clinicians document patient care—remains consistent. Bernstorff addressed this by examining the Lexical Stability of Psychiatric Clinical Notes from Electronic Health Records over a Decade, finding that despite administrative changes and external shocks like the COVID-19 pandemic, the linguistic structure of clinical notes remained stable enough to support the long-term use of Natural Language Processing (NLP) models.
By 2023, Bernstorff’s work shifted toward the development of specialized methodological tools to handle the complexities of EHR data. He led the development of timeseriesflattener: A Python package for summarizing features from (medical) time series, which automates the conversion of messy, irregularly sampled temporal data into fixed-length feature vectors. This tool was designed to enforce best practices in feature engineering, particularly in preventing data leakage and ensuring that models remain clinically relevant when transitioned from retrospective training to prospective application.
During this same period, Bernstorff applied these methodological frameworks to specific clinical challenges, most notably the prediction of metabolic complications in psychiatric populations. He led the Development and validation of a machine learning model for prediction of type 2 diabetes in patients with mental illness, demonstrating that routine EHR data could identify high-risk individuals years before a clinical diagnosis. This work highlighted the potential for machine learning to inform preventative interventions in high-risk groups.
In 2024 and 2025, Bernstorff’s research has expanded into more complex diagnostic transitions and the broader application of NLP in specialized medical domains. He contributed to research Predicting Diagnostic Progression to Schizophrenia or Bipolar Disorder via Machine Learning applied to electronic health record data, which identified clinical notes as the most potent predictors for schizophrenia progression. Additionally, he has taken an active role in translating these technical findings for a clinical audience, providing guidance on the Natural language processing for electronic health records in anaesthesiology: an introduction to clinicians with recommendations and pitfalls.
Current Directions
Bernstorff’s current work is increasingly focused on the nuances of Transforming Unstructured Clinical Text into Structured Data. While structured data like lab results are easily processed, the "clinical soul" of the patient record often resides in the physician's notes. His research explores the Integrating Clinical Narratives with Structured Medical Data to create more holistic predictive models.
A significant portion of his recent focus involves the ethical and technical implications of using Large Language Models (LLMs) in healthcare. This includes investigating Demographic Inference from Implicit Linguistic Proxies, where models may inadvertently learn sensitive attributes like race or gender from text even when those variables are explicitly removed. To address the limitations of general-purpose models in medical contexts, Bernstorff is also involved in research regarding Pre-Training Language Models on Specialized Corpora, ensuring that models can accurately interpret the dense jargon and specific contexts of clinical documentation.
Representative Work
timeseriesflattener: A Python package for summarizing features from (medical) time series As the lead author, Bernstorff developed this package to address the "flattening" problem in medical machine learning. The software provides a standardized pipeline for transforming temporal EHR data into a format suitable for standard classifiers while maintaining strict temporal boundaries to prevent data leakage. This work represents a significant methodological contribution to the reproducibility of clinical ML pipelines. Link to paper
Development and validation of a machine learning model for prediction of type 2 diabetes in patients with mental illness In this first-author study, Bernstorff developed an XGBoost-based model to predict the onset of Type 2 Diabetes (T2D) using routine EHR data from psychiatric patients. The model achieved an AUROC of 0.84 and demonstrated the ability to identify at-risk patients an average of 2.7 years before clinical diagnosis. This research illustrates the practical utility of EHR-based screening tools for managing physical health comorbidities in psychiatric care. Link to paper
Predicting Diagnostic Progression to Schizophrenia or Bipolar Disorder via Machine Learning Serving as the second author, Bernstorff contributed to the development of models designed to forecast the transition from minor mental health issues to severe psychiatric disorders. The study found that unstructured clinical notes were the most effective data source for predicting schizophrenia (AUROC 0.80), whereas bipolar disorder proved significantly more challenging to forecast, highlighting the varying predictability of different psychiatric trajectories. Link to paper
Natural language processing for electronic health records in anaesthesiology: an introduction to clinicians with recommendations and pitfalls In this first-author editorial, Bernstorff provides a high-level primer for clinicians on the application of NLP. The work demystifies the transition from simple word counts to complex Transformer models while emphasizing critical pitfalls such as "parroting" (where models repeat existing clinical knowledge without adding predictive value) and the subtle ways data leakage can occur in clinical text. Link to paper
Lexical Stability of Psychiatric Clinical Notes from Electronic Health Records over a Decade As a third author, Bernstorff investigated the longitudinal consistency of clinical documentation. By analyzing 14.8 million notes over ten years, the study confirmed that the lexical and syntactic structures of psychiatric notes are remarkably stable. This finding is foundational for the field, as it suggests that NLP models trained on historical data remain valid for contemporary clinical environments. Link to paper
The PSYchiatric clinical outcome prediction (PSYCOP) cohort: leveraging the potential of electronic health records in the treatment of mental disorders Bernstorff participated in the development of the PSYCOP cohort, a large-scale representative dataset designed for precision psychiatry. This work established the data infrastructure necessary for the state-of-the-art machine learning applications that characterize his later research, focusing on improving treatment quality and life expectancy for individuals with mental illness. Link to paper
Profile updated
Loading new papers…
Other researchers whose papers cluster into the same research directions — a proxy for overlapping technical interests and shared intellectual neighborhoods.
See something wrong? Report a mistake