RAxSS: Retrieval-Augmented Sparse Sampling for Explainable Variable-Length Medical Time Series Classification

Aydin Javadov, Samir Garibov, Tobias Hoesli, Qiyang Sun, Joseph Ollier, Florian von Wangenheim, Björn Schuller · DOI

Introduction

Medical time series data, such as intracranial EEG (iEEG) recordings used to locate seizure onsets, present significant challenges for automated classification. These recordings are often of variable lengths, sparse in relevant events, and heavily contaminated with noise. Traditional deep learning models typically require fixed-length inputs and often operate as "black boxes," lacking the interpretability necessary for clinical trust.

To address these issues, the RAxSS (Retrieval-Augmented Sparse Sampling) framework introduces a novel approach that combines stochastic sparse sampling with a retrieval mechanism. This mimics how medical experts cross-reference patterns within a recording to make informed decisions.

The Challenge of Variable-Length Medical Data

The primary hurdle in clinical settings is Variable-Length Medical Time Series Classification (VTSC). Monitoring devices like heart rate monitors or EEGs generate data over varying durations. While Stochastic Sparse Sampling (SSS) was previously introduced to handle this by sampling fixed-length windows, it treats all segments with equal importance. In reality, a brief window containing a seizure onset is far more critical than hours of background noise. Furthermore, clinicians require an explanation for a model's findings—a "why" to accompany the "where."

The RAxSS Framework

RAxSS enhances the SSS framework by implementing a Retrieval-Informed Aggregation strategy. The process follows several key steps:

  1. Stochastic Sampling: Fixed-length windows are sampled from long recordings, with the number of samples proportional to the total recording length.
  2. Within-Series Retrieval: For each sampled window (the "query"), the system identifies the $m$ most similar segments (the "neighbors") within the same recording using metrics like Pearson or Cosine similarity.
  3. Similarity-Based Weighting: Windows with numerous similar neighbors are deemed more representative and assigned higher weights ($\alpha_k$) via a temperature-scaled softmax.
  4. Convex Aggregation: The final recording-level prediction is a weighted sum of individual window predictions.
The RAxSS architecture overview, showing the transition from raw time series to retrieval-informed batch predictions.

Explainability and Attribution

A standout feature of RAxSS is its built-in explainability module. By deriving weights from explicit similarity scores, the model generates a "leaderboard" of evidence. This allows clinicians to see not just the localization of a high-probability event but also the specific segments that "voted" for its importance.

Localization vs. Attribution in RAxSS: Identifying 'where' a seizure occurs and 'why' based on retrieved similar windows.

Experimental Setup and Results

The framework was evaluated using the Epilepsy iEEG Multicenter Dataset, which includes data from four major medical centers. The task was Seizure Onset Zone (SOZ) localization using ECoG data sampled at 250–1000 Hz.

RAxSS demonstrated state-of-the-art performance against various time series models:

  • Performance: The Cosine similarity variant achieved a peak AUC of 0.8046, while the Pearson variant provided a balanced F1-score of 0.7275 and 70.51% accuracy.
  • Robustness: By outperforming non-sampling baselines like PatchTST, RAxSS proved that combining sparse sampling with retrieval is highly effective for noisy, multicenter clinical data.
  • Transparency: The model's weighting mechanism is mathematically "faithful," ensuring that as a window's similarity to its neighbors increases, its contribution to the final classification score also increases.

Conclusion and Future Directions

RAxSS represents a significant step forward in making medical AI both accurate and interpretable. While currently limited to within-patient retrieval, future work could explore "pattern-level retrieval" across broader patient databases. Additionally, automating the tuning of hyperparameters like the number of neighbors and optimizing the retrieval step for real-time bedside monitoring remain key areas for development.

Summary updated

BibTeX
@misc{javadov2025raxss,
  author = {Aydin Javadov and Samir Garibov and Tobias Hoesli and Qiyang Sun and Joseph Ollier and Florian von Wangenheim and Björn Schuller},
  title = {{RAxSS: Retrieval-Augmented Sparse Sampling for Explainable Variable-Length Medical Time Series Classification}},
  year = {2025},
  eprint = {2510.02936},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.02936},
}
Figure