Detecting defense mechanisms from Adult Attachment Interview (AAI) transcripts using machine learning

Psychother Res. 2023 Jul;33(6):757-767. doi: 10.1080/10503307.2022.2156306. Epub 2022 Dec 16.

Abstract

Objective: Defensive functioning (i.e., unconscious process used to manage real or perceived threats) may play a role in the development of various psychopathologies. It is typically assessed via observer rating measures, however, human coding of defensive functioning is resource-intensive and time-consuming. The purpose of this study was to develop a machine learning approach to automate coding of defense mechanisms from interview transcripts.

Method: Participants included a clinical sample of women with binge-eating disorder (n = 92) and a community sample without binge-eating disorder (n = 66). We trained and evaluated five RoBERTa-based models to detect the presence of defenses in 16,785 interviewer-participant talk-turn pairs nested within 192 interviews. A model detected the presence of any defense, while four additional models detected the most common defenses in this sample (repression, intellectualization, reaction formation, undoing).

Results: The models were capable of distinguishing defenses (ROC-AUC .82-.90) but were not proficient enough to warrant replacing human coders (PR-AUC .28-.60). Follow-up analysis was performed to assess other practical uses of these models.

Discussion: Our machine learning models could be used to assist coders. Future research should conduct a deployment study to determine if human coding of defense mechanisms can be expedited using machine learning models.

Keywords: Defense Mechanism Rating Scale; RoBERTa; conversation analysis; defensive functioning; machine learning.

MeSH terms

  • Adult
  • Binge-Eating Disorder / psychology
  • Defense Mechanisms*
  • Female
  • Humans
  • Machine Learning*