top of page

DUDE: Deep unsupervised domain adaptation using variable nEighborsfor physiological time series analysis

By Jeremy Levy, Noam Ben-Moshe, Uri Shalit, and Joachim A. Behar.


Deep learning has changed the way we analyze physiological time-series such as ECG, SpO₂, and PPG signals. Modern neural networks routinely match and sometimes exceed expert performance in clinical tasks, from detecting atrial fibrillation to staging sleep.


But there’s a catch: these models often break when moved from one patient population to another. That means a model trained in one hospital may underperform badly in another. Different ethnicities, different sensors, different comorbidities, different geographies these subtle shifts in data distribution can cripple a seemingly strong model.


This is one of the biggest unsolved problems in medical AI: How do we ensure that a deep learning model trained on one domain remains reliable when deployed elsewhere?


Our newly published study proposes a compelling solution: DUDE — Deep Unsupervised Domain adaptation using variable nEighbors.


Below is an accessible walkthrough of what DUDE is, why it matters, and what the results show

.

Why Domain Adaptation Matters in Medical AI

Medical datasets are rarely homogeneous. A model trained on middle-aged Americans may not work on elderly Japanese patients. Oximeters behave differently on darker skin tones. ECGs vary by device, electrode placement, and hospital practices.


The study focuses on the unsupervised domain adaptation (UDA) setting:

  • Source domain: labeled data (e.g., an existing dataset with annotations)

  • Target domain: unlabeled data (commonly the real-world environment where the model will be deployed)


UDA aims to align the model’s internal representations across domains—without needing additional labels.


This is especially important in medicine, where labeling new datasets requires expensive clinical expertise.


What Is DUDE?

DUDE is a framework designed to help deep learning models adapt when the target domain looks different from the training domain. It builds on two main components:


1. Domain Shift Uncertainty (DSU) layers

DSU layers model uncertainty in feature statistics during training. Instead of assuming features are fixed, DSU injects controlled variability to make the encoder more robust to future distribution shifts.


2. NNCLR∆: An improved contrastive learning strategy

Contrastive learning teaches the network to bring similar samples closer in embedding space and push dissimilar ones apart.

Classic NNCLR picks one nearest neighbor in the latent space to define similarity.

DUDE introduces NNCLR∆, which:

  • Selects multiple neighbors, not just one

  • Determines how many neighbors to use dynamically, based on local density

  • Weights each neighbor by its distance

  • Ignores neighbors that are too far away (beyond a threshold ∆)

This adaptive mechanism allows DUDE to better represent complex, heterogeneous physiological signals which is an important step when source and target domains differ substantially.


ree

Figure: A high-level overview of the DUDE framework proposed. In the source domain, labeled data is used for supervised loss, which is task-dependent. The embedding generated by the encoder is stored in the support set. In the target domains, unlabeled data is used for contrastive learning. The contrastive loss with multiple nearest neighbors enables better alignment and robust DA.


Experimental Setup

The team evaluated DUDE on three clinically important tasks, spanning eight real-world datasets and several forms of distribution shift:


1. Obstructive Sleep Apnea (OSA) diagnosis using overnight SpO₂

Distribution shifts: demographics, BMI, comorbidities, medical centers, ethnicity.


2. Atrial fibrillation detection from ECG

Distribution shifts: geography (USA, Japan, Israel).


3. Sleep staging from PPG

Distribution shifts: age differences and clinical sites.

Across all experiments, the source domain had labels; the target domains contributed only unlabeled samples for adaptation.

Performance was measured using F1 score (classification tasks) or Cohen’s kappa (sleep staging).


Key Results

Across nearly all experiments, DUDE achieved the best performance, outperforming:

  • Baseline supervised models

  • DSU alone

  • MUST

  • CAD

  • Supervised contrastive learning (SCL)

  • The original NNCLR algorithm


ree

Figure: Results of experiments across source and target domains, with error bars obtained via bootstrapping the test set. DUDE represents our final framework, which builds on NNCLR∆. Subplots (a)–(d) correspond to: (a) experiment 1 (OSA diagnosis with dataset as the domain shift), (b) experiment 2 (ethnicity as the domain shift), (c) experiment 3 (AF diagnosis), and (d) experiment 4 (sleep staging classification).


Highlights:


OSA diagnosis (SpO₂)

  • DUDE improved F1 scores across all datasets

  • Gains of 0.01–0.07 compared to the baseline

  • Gains of 0.04–0.08 in ethnicity-based evaluation, addressing model bias


AF detection (ECG)

  • DUDE delivered major improvements, with up to +0.16 F1 on target domains

  • Performance on the source domain was maintained, not sacrificed


Sleep staging (PPG)

  • DUDE improved kappa from 0.70 → 0.72 on target domain

  • Incremental improvement suggests the covariate shift assumption may be weaker here—but DUDE still performed best


Why does adaptive neighbor selection help?

The ablation studies show:

  • Random neighbors → sharp performance drop

  • Too many neighbors → degraded performance

  • Dynamically selected neighbors → consistent improvements

The average optimal number of neighbors was between 3–4 across datasets.


Why DUDE Matters

DUDE advances UDA for physiological time-series by:

  • Handling non-overlapping domain supports

  • Using unlabeled target data efficiently

  • Preserving source-domain performance

  • Robustifying feature extraction via DSU

  • Capturing meaningful local structure through adaptive contrastive learning


This framework offers a path toward deployable medical AI models that don’t collapse when exposed to new patient populations.


For medical AI to be trustworthy and fair, especially across global and diverse healthcare environments, methods like DUDE are essential.


What’s Next?

The authors outline opportunities for future research:

  • Using more advanced clustering algorithms for neighbor selection

  • Evaluating additional UDA methods

  • Improving augmentation strategies for time-series

  • Extending DUDE to multimodal or multivariate physiological signals

  • Applying DUDE beyond medicine to generic time-series adaptation problems

The code is planned to be open-sourced upon publication, enabling the community to build on the framework.


Final Thoughts

Distribution shift is one of the most persistent challenges in deploying medical AI. DUDE represents a promising step forward, showing that adaptive neighbor–based contrastive learning can help deep learning models remain accurate even when entering unfamiliar environments.

The results suggest that meaningful representation alignment is achievable without labeled target data, an important milestone for scalable, safe, and equitable medical AI.

 
 
 

Comments


bottom of page