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

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

Research output: Chapter in Book/Published conference outputChapter


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: The First Five Years of the eRisk Project
EditorsFabio Crestani, David E. Losada, Javier Parapar
ISBN (Electronic)9783031044311
Publication statusPublished - 15 Sept 2022

Publication series

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

Bibliographical note

Copyright © 2022, The Author(s), under exclusive license to Springer Nature Switzerland AG. Funding & Acknowledgements: The first author would like to thank the following funding bodies for their support: FEDER/Ministerio de Ciencia, Innovación y Universidades, Agencia Estatal de Investi-gación/Project (RTI2018-093336-B-C21), Consellería de Educación, Universidade e Formación Profesional and the European Regional Development Fund (ERDF) (accreditation 2019-2022 ED431G-2019/04, ED431C 2018/29, ED431C 2018/19). The second and third authors would like to thank the UKRI’s EPSRC Project Cumulative Revelations in Personal Data (Grant Number: EP/R033897/1) for their support. We would also like to thank David Losada for arranging this collaboration.


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

Cite this