Skip to main content
QUICK REVIEW

[Paper Review] Medformer: A Multi-Granularity Patching Transformer for Medical Time-Series Classification

Yihe Wang, Nan Huang|arXiv (Cornell University)|May 24, 2024
Time Series Analysis and ForecastingComputer Science16 citations
TL;DR

Medformer introduces cross-channel multi-granularity patching and two-stage multi-granularity self-attention to improve medical time-series classification, achieving top performance across EEG and ECG datasets.

ABSTRACT

Medical time series (MedTS) data, such as Electroencephalography (EEG) and Electrocardiography (ECG), play a crucial role in healthcare, such as diagnosing brain and heart diseases. Existing methods for MedTS classification primarily rely on handcrafted biomarkers extraction and CNN-based models, with limited exploration of transformer-based models. In this paper, we introduce Medformer, a multi-granularity patching transformer tailored specifically for MedTS classification. Our method incorporates three novel mechanisms to leverage the unique characteristics of MedTS: cross-channel patching to leverage inter-channel correlations, multi-granularity embedding for capturing features at different scales, and two-stage (intra- and inter-granularity) multi-granularity self-attention for learning features and correlations within and among granularities. We conduct extensive experiments on five public datasets under both subject-dependent and challenging subject-independent setups. Results demonstrate Medformer's superiority over 10 baselines, achieving top averaged ranking across five datasets on all six evaluation metrics. These findings underscore the significant impact of our method on healthcare applications, such as diagnosing Myocardial Infarction, Alzheimer's, and Parkinson's disease. We release the source code at https://github.com/DL4mHealth/Medformer.

Motivation & Objective

  • Motivate improved learning for medical time series by capturing intra- and inter-channel correlations.
  • Leverage multi-granularity temporal features to emulate multiple frequency bands without handcrafted filters.
  • Introduce cross-channel patching to model inter-channel dependencies.
  • Develop a two-stage self-attention mechanism (intra- and inter-granularity) to learn within- and across-granularity relations.

Proposed method

  • Propose cross-channel multi-granularity patching to create patch embeddings from multiple patch lengths across all channels.
  • Use a linear projection to obtain embeddings for each granularity and apply data augmentations to produce augmented embeddings.
  • Incorporate a granularity embedding and a router vector for each granularity to enable differentiated processing.
  • Perform intra-granularity self-attention with a shared attention block across all granularities, updating both patch and router embeddings.
  • Perform inter-granularity self-attention among granularity routers to capture cross-scale correlations, reducing computational complexity to O(sum Ni^2 + n^2).
  • Concatenate outputs from all granularities after M self-attention layers to form the final representation for classification.
Figure 1 : Token embedding methods. Vanilla transformer, Autoformer, and Informer [ 28 , 26 , 27 ] employ a single cross-channel timestamp as a token; iTransformer [ 29 ] utilizes an entire channel as a token; and PatchTST and Crossformer [ 30 , 34 ] adopt a patch of timestamps from one channel as a
Figure 1 : Token embedding methods. Vanilla transformer, Autoformer, and Informer [ 28 , 26 , 27 ] employ a single cross-channel timestamp as a token; iTransformer [ 29 ] utilizes an entire channel as a token; and PatchTST and Crossformer [ 30 , 34 ] adopt a patch of timestamps from one channel as a

Experimental results

Research questions

  • RQ1Can cross-channel, multi-granularity patching improve learning of inter-channel correlations in medical time series?
  • RQ2Does a two-stage (intra- and inter-granularity) self-attention mechanism improve performance by capturing within- and across-granularity relationships?
  • RQ3Can multi-granularity patching simulate multi-frequency band features without handcrafted filtering?
  • RQ4How does Medformer perform on subject-dependent vs. subject-independent medical time-series classification tasks?

Key findings

  • Medformer achieves the best average ranking across five datasets on six evaluation metrics in the reported experiments.
  • Across datasets, Medformer consistently outperforms 10 baselines in subject-dependent and subject-independent setups.
  • In subject-dependent results, Medformer shows competitive or leading accuracy, precision, recall, F1, AUROC, and AUPRC compared to the baselines (specific numbers reported in the study).
  • In subject-independent results, Medformer maintains strong performance across datasets, frequently surpassing competing transformer models.
  • The model emphasizes multi-channel (cross-channel) patching and multi-granularity analysis to capture temporal dynamics and inter-channel relationships (e.g., EEG/ECG settings).
Figure 2 : Subject-dependent/independent setups (adopted from [ 13 ] ). In the subject-dependent setup, samples from the same subject can appear in both the training and test sets, causing information leakage. In a subject-independent setup, samples from the same subject are exclusively in either th
Figure 2 : Subject-dependent/independent setups (adopted from [ 13 ] ). In the subject-dependent setup, samples from the same subject can appear in both the training and test sets, causing information leakage. In a subject-independent setup, samples from the same subject are exclusively in either th

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.