Evaluating Bayesian deep learning for robust biomedical time-series classification under distribution shift: A sleep scoring case study

Mads Birch Sørensen, Ulrike Richter, Francois Gastambide, Michael Riis AndersenarXiv 2026

In the world of biomedical machine learning, "distribution shift" is the elephant in the room. You train a model on data from one lab, but when you deploy it in another—or on a different patient population—performance often falls off a cliff. Even worse, models tend to become overconfident in their wrong answers.

A recent paper from researchers at the Technical University of Denmark and H. Lundbeck A/S, titled "Evaluating Bayesian deep learning for robust biomedical time-series classification under distribution shift: A sleep scoring case study," takes a deep dive into whether Bayesian methods can fix this. Using rodent sleep scoring as a challenging test case, they systematically evaluate whether Bayesian Model Averaging (BMA) actually delivers on its promise of robustness.

TL;DR

Bayesian Model Averaging, particularly "multi-basin" methods like Deep Ensembles and MultiSWAG, significantly improves the accuracy and calibration of biomedical time-series models under real-world distribution shifts. While these methods offer only modest gains on data similar to the training set, they are transformative for out-of-distribution (OOD) data, enabling more reliable error flagging and selective prediction.

What Problem Does This Paper Address?

Machine learning models for biomedical signals (like EEG or EMG) are notoriously sensitive to changes in recording hardware, genotypes, and even species. This is known as distribution shift. When a model encounters data that looks different from its training set, its accuracy drops, and its probability estimates (confidence) become "uncalibrated"—meaning it doesn't know when it's likely to be wrong.

Bayesian Deep Learning (BDL) offers a theoretical solution: instead of finding one "best" set of model weights, we infer a distribution over all possible weights. By averaging predictions across this distribution (BMA), we should theoretically get more robust results and better uncertainty estimates. However, whether this works for the complex, "structured" shifts found in real-world biomedical data remained an open question.

Methods

The authors compared a standard point-estimate approach (Maximum A Posteriori or MAP) against nine different approximate Bayesian inference methods. These methods fall into two main categories:

  1. Single-basin methods: These characterize uncertainty around a single solution in the weight space. Examples include the Last-Layer Laplace Approximation (LLLA), Stochastic Weight Averaging (SWA/SWAG), and Variational Inference (MFVI/VGD).
  2. Multi-basin methods: These average predictions across multiple, independently found solutions. This includes Deep Ensembles (DE) and hybrid approaches like MultiSWAG.

They tested these methods across two different neural network architectures: U-Sleep (a fully convolutional encoder-decoder) and a CNN-GRU (combining convolutions with recurrent units).

Table 1: Method-specific parameter distributions used for BMA.

Datasets

The study used a massive "in-the-wild" source dataset for training and five distinct out-of-distribution (OOD) cohorts to test robustness.

  • Source (ID): Wild-type (WT) mice recorded at Lundbeck.
  • OOD Cohorts:
    • NT1: Mice with a specific narcolepsy genotype.
  • SPINDLE A & D: Data from different external laboratories.
  • SPINDLE B: Lab shift + a different mutant genotype.
  • SPINDLE C: Lab shift + a different species (Rats).
Table 2: Summary of datasets and the primary shifts they represent.

Key Insights and Ideas

  • Multi-basin is King: The most significant finding was that multi-basin methods (DE, MultiSWAG) consistently outperformed single-basin ones. Capturing diverse "modes" of the posterior distribution is more important for robustness than finely detailing the shape of a single mode.
  • Gains are Shift-Dependent: BMA provided only modest improvements on in-distribution data. The "Aha!" moment is that the benefits of Bayesian methods scale with the severity of the distribution shift. It helps most exactly where the standard models fail hardest.
  • Uncertainty is Task-Specific: While BMA uncertainty was excellent for detecting OOD data and artifacts, it did not significantly improve the detection of inter-rater disagreement (where two human experts disagree). This suggests that "epistemic" uncertainty (model ignorance) and "aleatoric" uncertainty (inherent data ambiguity) are distinct and need to be handled differently.
  • SWAG as a Practical Middle Ground: While ensembles are expensive, SWAG (which approximates a Gaussian distribution along the SGD trajectory) provided consistent OOD gains across both architectures, making it a strong single-trajectory alternative.

Key Results

The quantitative results highlight a clear win for Bayesian averaging under shift.

  • Accuracy Boost: For the U-Sleep backbone on OOD data, the best multi-basin method (MultiSWAG) increased the Macro F1 score from 76.0% (MAP) to 82.5%.
  • Calibration: Probabilistic performance (measured by Log Predictive Density, LPD) improved drastically. For U-Sleep, Deep Ensembles improved OOD LPD from -0.481 to -0.299.
  • Error Flagging: Multi-basin methods were significantly better at "selective prediction"—rejecting the most uncertain predictions to maintain high accuracy.
Figure 1: Comparison of In-Distribution vs. OOD performance (LPD). Multi-basin methods (top right) clearly dominate.
Table 4: Out-of-distribution performance, each metric averaged over the five OOD cohorts (NT1 + SleepyRat A– D), computed per training seed; mean ± 95% CI over train- ing seeds (t-based); for DE, MultiSWA and MultiSWAG, mean ± half the 2.5–97.5% interval over 100 bootstrap draws of ten members of that average. bold = best in the column over all models, underline = best within its section.

Limitations and Future Work

The authors acknowledge that their study is limited to rodent sleep scoring and relatively small OOD cohorts. Because multiple shift factors (like lab and genotype) often co-occur in their data, it's difficult to isolate the impact of a single factor.

Future work should explore whether these findings hold for other biomedical time-series tasks (like human ECG or seizure detection) and investigate ways to reduce the high computational cost associated with multi-basin Bayesian methods without sacrificing their robustness.

Summary updated

Abstract

In biomedical time-series classification, machine learning models often suffer from deteriorating accuracy and calibration due to distribution shift. We investigate to what degree Bayesian-inspired deep learning improves robustness through Bayesian model averaging (BMA). Using rodent sleep scoring as a case study, we evaluate BMA under distribution shifts in genotype, laboratory, and species. We systematically compare nine approximate inference methods spanning single- and multi-basin approaches across two neural network backbones on in-distribution (ID) data and five out-of-distribution (OOD) datasets. In our results, multi-basin methods perform best, outperforming baselines and single-basin methods. Compared with point estimates, BMA generally improves OOD accuracy and calibration across both architectures, while yielding only modest ID gains. It also often improves selective prediction and OOD and artifact detection, but, interestingly, not inter-rater disagreement detection.
BibTeX
@misc{srensen2026evaluating,
  author = {Mads Birch Sørensen and Ulrike Richter and Francois Gastambide and Michael Riis Andersen},
  title = {{Evaluating Bayesian deep learning for robust biomedical time-series classification under distribution shift: A sleep scoring case study}},
  year = {2026},
  eprint = {2610.35484},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.35484},
}
Figure