Early risk detection of self-harm using BERT-based transformers

Rodrigo Martínez-Castaño*, Amal Htait, Leif Azzopardi, Yashar Moshfeghi

*Corresponding author for this work

Research output: Chapter in Book/Report/Conference proceedingChapter


In the past few years, individuals choose increasingly to share online about themselves, which reflect greatly about their personality and self-image. In particular, individuals with mental health issues tend to discuss or mention such issues online, in an obvious or concealed way. Thus, analysing individuals' online posts for mental health, became critical for an early detection and fast intervention. This chapter presents our efforts towards detecting mental health issues by focusing on the task: Early Detection of Signs of Self-Harm. Core to how we approached this problem was the use of BERT-based classifiers which were trained specifically for each task. Additional investigations of the efficiency of this method in detecting mental health issues are also presented with the following tasks: Early Detection of Signs of Anorexia and Early Detection of Signs of Depression. Our results indicate that this approach delivers high performance across a series of measures, particularly for self-harm and anorexia, where our classifiers obtained the best performance for precision, F1, latency-weighted F1, and ERDE at 5 and 50. This work suggests that BERT-based classifiers, when trained appropriately, can accurately infer which social media users are at risk of self-harming, with precision up to 91.3 and 83.9% for anorexia. Given these promising results, it will be interesting to further refine the training regime, classifier and early detection scoring mechanism, as well as apply the same approach to other related tasks (e.g., pathological gambling, suicide).

Original languageEnglish
Title of host publicationEarly Detection of Mental Health Disorders by Social Media Monitoring
Subtitle of host publicationThe First Five Years of the eRisk Project
EditorsFabio Crestani, David E. Losada, Javier Parapar
Place of PublicationCham, Switzerland
PublisherSpringer Science and Business Media Deutschland GmbH
Number of pages24
ISBN (Electronic)9783031044311
ISBN (Print)9783031044304
Publication statusPublished - 22 Sept 2022

Publication series

NameStudies in Computational Intelligence
ISSN (Print)1860-949X
ISSN (Electronic)1860-9503


  • mental health
  • early detection of self harm
  • detecting mental health issues


Dive into the research topics of 'Early risk detection of self-harm using BERT-based transformers'. Together they form a unique fingerprint.

Cite this