Maintenance Notice

Due to necessary scheduled maintenance, the JMIR Publications website will be unavailable from Wednesday, July 01, 2020 at 8:00 PM to 10:00 PM EST. We apologize in advance for any inconvenience this may cause you.

Who will be affected?

Accepted for/Published in: Journal of Medical Internet Research

Date Submitted: Jul 5, 2024
Date Accepted: Jan 16, 2025

The final, peer-reviewed published version of this preprint can be found here:

Emotion Forecasting: A Transformer-Based Approach

Arbaizar LP, Lopez-Castroman J, Artés-Rodríguez A, Olmos PM, Ramírez D

Emotion Forecasting: A Transformer-Based Approach

J Med Internet Res 2025;27:e63962

DOI: 10.2196/63962

PMID: 40101216

PMCID: 11962324

Emotion Forecasting: A Transformer-Based Approach

  • Leire P. Arbaizar; 
  • Jorge Lopez-Castroman; 
  • Antonio Artés-Rodríguez; 
  • Pablo M. Olmos; 
  • David Ramírez

ABSTRACT

Background:

Monitoring the emotional states of psychiatric patients has always been challenging due to the non-continuous nature of clinical assessments, the effect of being in a healthcare environment, and the inherent subjectivity of existing evaluation instruments. However, mental states in psychiatric disorders exhibit significant variability over time, making real-time monitoring crucial for preventing risk situations and ensuring appropriate treatment.

Objective:

Our objective is to leverage new technologies and deep learning techniques to enable a more objective, real-time monitoring of patients. This will be achieved by passively monitoring variables like step count, patient location, and sleep patterns using mobile devices. We aim to predict patient self-reports and detect sudden variations in their emotional valence, identifying situations that may require clinical intervention.

Methods:

Data for this project are registered with the Evidence-Based Behavior (eB2) MindCare mobile application, where both passively and self-reported variables are recorded from patients. We utilize daily summaries of these variables. We implement imputation methods based on hidden Markov model (HMM) to address missing data and transformer deep neural networks for time-series forecasting. Finally, classification algorithms are applied to predict several variables, including emotional state and responses to the Patient Health Questionnaire (PHQ-9).

Results:

Through real-time patient monitoring, we demonstrated the ability to accurately predict their emotional state, obtaining an accuracy of 0.93 and 0.98 of receiver operating characteristic (ROC) area under the curve (AUC) for emotional valence classification with an XGBoost classifier and anticipate emotional state changes (ROC AUC of 0.87 for change detection one day in advance). Additionally, we showed the feasibility of forecasting general responses to the PHQ-9 questionnaire. Especially good results were obtained for the score prediction of certain questions. For instance, in the case of question 9, related to suicidal ideation, we obtained an accuracy of 0.9 and ROC AUC of 0.768 in predicting the following day’s response. Secondly, from a methodological perspective, we illustrate the enhanced stability of multivariate time-series forecasting when combining HMM pre-processing with a transformer model, as opposed to other time-series forecasting methods, such as the Recurrent Neural Network or the Long Short- Term Memory cells. Concretely, we exploit the capabilities offered by attention mechanisms to capture longer time dependencies.

Conclusions:

From a methodological perspective, we found out that the stability of multivariate time-series forecasting improved when combining hidden Markov model pre-processing with a transformer model, as opposed to other time-series forecasting methods (RNN, LSTM...), leveraging the attention mechanisms to capture longer time dependencies and gain interpretability. We show the potential to assess the emotional state of a patient and the scores of psychiatric questionnaires from passive variables in advance. This offers a real real-time monitoring of patients and hence better risk detection and treatment adjustment.


 Citation

Please cite as:

Arbaizar LP, Lopez-Castroman J, Artés-Rodríguez A, Olmos PM, Ramírez D

Emotion Forecasting: A Transformer-Based Approach

J Med Internet Res 2025;27:e63962

DOI: 10.2196/63962

PMID: 40101216

PMCID: 11962324

Download PDF


Request queued. Please wait while the file is being generated. It may take some time.

© The authors. All rights reserved. This is a privileged document currently under peer-review/community review (or an accepted/rejected manuscript). Authors have provided JMIR Publications with an exclusive license to publish this preprint on it's website for review and ahead-of-print citation purposes only. While the final peer-reviewed paper may be licensed under a cc-by license on publication, at this stage authors and publisher expressively prohibit redistribution of this draft paper other than for review purposes.