Publications

Below is a selection of my recent research publications in psychology, machine learning, and mental health.

Evaluating Open-Source Solutions for Computerized Inference of Infant Facial Affect

Trinhammer, ML; Krogh, MT; Stuart, AC; Vaever, MS; Brandt, SB; Grasshof, S (2026)

Developmental Science. https://doi.org/10.1111/desc.70156

Show abstract

Infant affect is often displayed through facial expressions, leaving this modality a key source of insight into the well-being and social functioning of the child. Computational inference of infant affect could critically assist both researchers and clinicians working with infant development and mitigate the need for manual coding. While many studies have explored open-source solutions in the adult domain, only the commercial Baby FaceReader 9 exists for the infant domain. To address this gap, we utilize the recently proposed, open-source infant-native action unit (AU) detection library PyAFAR (Python-based Automated Facial Action Recognition) on a sample of 71 four-month old infants, whose facial expressions were annotated manually frame-by-frame for three minutes according to the Infant Facial Affect (IFA) coding scheme. Using these AUs as features, we classify negative, neutral and positive facial affect using XGBoost and Bayesian filtering, both in a multiclass and a binary setup. Our results show that the AUs estimates from PyAFAR combined with an XGBoost classification model can distinguish positive from neutral and positive from negative affect with AUC scores of 78\% and 76\%. This performance is largely on par with that reported in evaluation studies of the Baby FaceReader 9, when accounting for differences in study setup. Our work indicates that the area of infant facial affect is appropriate for imitation learning, given the availability of two different, commensurable theories underpinning the same phenomenon. Finally, we discuss how next iterations to PyAFAR may benefit from including AUs capturing more variability around infant forehead and mouth engagement.

Don't Predict If You Cannot Interpret: Investigating the Clinical Viability of Facial Movements for Machine-Learning Assisted Diagnostics of Bipolar Disorder

Trinhammer, ML; Grasshof, S; Kessing, LV; Kjaerstad, HL; Miskowiak, KW; Brandt, SB (2026)

Nordic Journal of Psychiatry. https://doi.org/10.1080/08039488.2026.2644576

Show abstract

Numerous studies have explored the possibility of developing automatic detection pipelines that can seamlessly diagnose patients with bipolar disorder (BD) and other mental illnesses. Such novel diagnostic tools increasingly rely on data sources, such as facial movements, whose relationship to BD has yet to be fully outlined. As such, these detection pipelines offer limited clinical value, despite promising performance estimates. A vital next step in achieving clinically reliable models is conducting granular interpretability analyses of which subsets of facial movements are responsible for determining patient or control class membership. In this work, we rely on facial movements encoded as action units (AUs) of 32 participants recorded while watching emotional film clips. Our objective is to delineate the specific facial micro-movements responsible for the differences between patients with BD and controls. We report how the movement of brow lowering (AU4) differentiates patients from controls with AUROC scores of up to 70% by applying the interpretable Fisher's Linear Discriminant Analysis in a binary, supervised classification design. Finally, we critically discuss the implications of this finding concerning current research designs in the context of facial movement analyses for mood disorders.

The Language of Attachment: Modeling Attachment Dynamics in Psychotherapy

Bredgaard, Frederik; Trinhammer, Martin Lund; Bassignana, Elisa (2025)

arXiv preprint arXiv:2504.16271. https://arxiv.org/abs/2504.16271

Show abstract

The delivery of mental healthcare through psychotherapy stands to benefit immensely from developments within Natural Language Processing (NLP), in particular through the automatic identification of patient specific qualities, such as attachment style. Currently, the assessment of attachment style is performed manually using the Patient Attachment Coding System (PACS; Talia et al., 2017), which is complex, resource-consuming and requires extensive training. To enable wide and scalable adoption of attachment informed treatment and research, we propose the first exploratory analysis into automatically assessing patient attachment style from psychotherapy transcripts using NLP classification models. We further analyze the results and discuss the implications of using automated tools for this purpose -- e.g., confusing `preoccupied' patients with `avoidant' likely has a more negative impact on therapy outcomes with respect to other mislabeling. Our work opens an avenue of research enabling more personalized psychotherapy and more targeted research into the mechanisms of psychotherapy through advancements in NLP

Predicting crime during or after psychiatric care: Evaluating machine learning for risk assessment using the Danish patient registries

Trinhammer, ML; Merrild, AC Holst; Lotz, Jonas Færch; Makransky, Guido (2022)

Journal of Psychiatric Research, 152:194-200. Elsevier. https://doi.org/10.1016/j.jpsychires.2022.06.009

Show abstract

Structural changes in psychiatric systems have altered treatment opportunities for patients in need of mental healthcare. These changes are possibly associated with an increase in post-discharge crime, reported in the increase of forensic psychiatric populations. As current risk-assessment tools are time-consuming to administer and offer limited accuracy, this study aims to develop a predictive model designed to identify psychiatric patients at risk of committing crime leading to a future forensic psychiatric treatment course. We utilized the longitudinal quality of the Danish patient registries, identifying the 45.720 adult patients who had contact with the psychiatric system in 2014, of which 474 committed crime leading to a forensic psychiatric treatment course after discharge. Four machine learning models (Logistic Regression, Random Forest, XGBoost and LightGBM) were applied over a range of sociodemographic, judicial, and psychiatric variables. This study achieves a F1-macro score of 76%, with precision = 57% and recall = 47% reported by the LightGBM algorithm. Our model was therefore able to identify 47% of future forensic psychiatric patients, while making correct predictions in 57% of cases. The study demonstrates how a clinically useful initial risk-assessment can be achieved using machine learning on data from patient registries. The proposed approach offers the opportunity to flag potential future forensic psychiatric patients, while in contact with the general psychiatric system, hereby allowing early-intervention initiatives to be activated.