Privacy-Preserving ECG-HRV Emotion Classification for Mood Swing Detection using Federated Learning on Constrained Edge Devices

Chidike Vincent, Muhammad Aslam Jarwar, Najam Ul Hasan, Laurence Hirsch, Jonathan Zasada-James, Hem Raj DadraarXiv 2026

TL;DR

Researchers have developed a privacy-preserving framework for detecting mood swings using heart rate variability (HRV) data from wearable ECG sensors. By utilizing Federated Learning on a cluster of Raspberry Pis, the system achieves emotion classification accuracy comparable to centralized models without ever moving raw, sensitive physiological data off the user's device.

What Problem Does This Paper Address?

Mood disorders often go undetected for years because traditional diagnosis relies on infrequent, subjective self-reporting. While wearable devices can continuously monitor physiological signals like the heart's electrical activity (ECG), bringing this technology into the real world faces three major hurdles:

  1. Generalization: Most existing models are trained and tested on the same individuals ("within-participant"), leading to inflated accuracy scores that crumble when applied to a new person.
  2. Resource Constraints: High-accuracy deep learning models often require GPUs, making them unsuitable for low-power "edge" devices like smartwatches or home monitors.
  3. Privacy: Continuous physiological monitoring creates a treasure trove of sensitive data. Centralizing this data in the cloud poses significant privacy risks.

The authors tackle these by proposing a lightweight, interpretable framework designed for cross-participant generalization and privacy-first distributed training.

Methods

The team’s approach centers on Heart Rate Variability (HRV)—the millisecond-level variations between heartbeats that reflect the balance of our autonomic nervous system.

Key technical components include:

  • Multi-window Segmentation: Instead of looking at a single snapshot, the system segments ECG signals into 45-second windows. This "multi-window" approach (see Figure 2) provides more training samples and allows for more robust "majority vote" predictions.
  • Feature Engineering: Rather than using "black box" deep learning, they extract nine standard, clinically interpretable HRV features (like RMSSD and SDNN) that correlate with stress and emotional states.
  • Federated Learning (FL): They deployed the model on a six-node Raspberry Pi cluster using the Flower framework. Using the FedAvg algorithm, each "client" node trains a local Logistic Regression model on its own data. Only the resulting model weights—not the raw ECG data—are sent to a master server to be aggregated into a global model.
  • Class Equalization: To combat the fact that "neutral" or "happy" states often outnumber "depressive" states in datasets, they used downsampling to ensure the model didn't ignore the critical minority classes.

![Fig.

  1. Proposed federated system architecture for ECG-HRV based mood detection.](/figures/art_6e88e3238eb94df887632d83afde0340)

Datasets

The framework was evaluated across three diverse public datasets to ensure it wasn't just "learning the quirks" of one specific study:

  • DREAMER: 23 participants, using low-cost off-the-shelf ECG/EEG.
  • AMIGOS: 15 participants, focused on affect and personality.
  • EmoWear: 36 participants, a recent dataset for wearable-based emotion recognition.

Additionally, they conducted a live pilot study using a Polar H10 chest strap on an unseen individual to test real-world "zero-shot" performance.

Key Insights and Ideas

  • The "Depressive State" Suppressor: The researchers found that class imbalance is the primary reason models fail to detect "Low Arousal, Low Valence" (LALV) states—the quadrant most closely associated with depression. By equalizing the classes, they improved LALV recall from a dismal 7.8% to 56.3% (see Figure 3).
  • The Physiological Ceiling: Interestingly, six different machine learning classifiers (from Random Forest to XGBoost) all converged to a similar accuracy range (49-53%) for unseen participants. This suggests that the bottleneck in emotion recognition isn't the algorithm, but the high physiological variability between individuals.
  • Personalization via Federated Learning: Because FL allows nodes to maintain local models, it provides a natural path for the system to "learn" an individual's unique cardiac baseline over time, potentially breaking through that physiological ceiling.

![Fig.

  1. Confusion matrices for four-class DREAMER classification.](/figures/art_ada939c947944087ab714f449c402be2)

Key Results

  • Cross-Participant Accuracy: On the DREAMER dataset, the model achieved 53.17% accuracy for binary valence (positive vs. negative emotion) using Leave-One-Participant-Out cross-validation. While this sounds low compared to laboratory "within-participant" scores (often >90%), it actually exceeds comparable subject-independent baselines.
  • Live Validation: In the real-world pilot study, the system achieved 75% binary valence accuracy on a completely unseen individual with zero prior calibration. Notably, it achieved 100% precision for negative valence, meaning it never falsely flagged a positive mood as negative.
  • Federated Parity: The federated model on Raspberry Pis achieved performance statistically equivalent to a centralized model. For example, on DREAMER, the federated model actually slightly outperformed the centralized one (53.99% vs 53.17%), proving that privacy doesn't have to come at the cost of utility.

Limitations and Future Work

The authors acknowledge that their live validation, while promising, was limited to a single participant and four stimuli. Larger-scale live trials are needed to confirm these results.

Furthermore, the current federated deployment assumes a shared local network. Moving to a geographically distributed system would require addressing encrypted transmission over the open web. Future iterations aim to incorporate multimodal data, such as combining ECG with EEG signals, to provide a more holistic view of a user's mental health while maintaining the same strict privacy standards.

Summary updated

BibTeX
@misc{vincent2026privacy,
  author = {Chidike Vincent and Muhammad Aslam Jarwar and Najam Ul Hasan and Laurence Hirsch and Jonathan Zasada-James and Hem Raj Dadra},
  title = {{Privacy-Preserving ECG-HRV Emotion Classification for Mood Swing Detection using Federated Learning on Constrained Edge Devices}},
  year = {2026},
  eprint = {2611.01853},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.01853},
}
Figure