Table of Contents
Fetching ...

Medformer: A Multi-Granularity Patching Transformer for Medical Time-Series Classification

Yihe Wang, Nan Huang, Taida Li, Yujun Yan, Xiang Zhang

TL;DR

Results demonstrate Medformer's superiority over 10 baselines, achieving top averaged ranking across five datasets on all six evaluation metrics, and underscore the significant impact of the method on healthcare applications, such as diagnosing Myocardial Infarction, Alzheimer's, and Parkinson's disease.

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.

Medformer: A Multi-Granularity Patching Transformer for Medical Time-Series Classification

TL;DR

Results demonstrate Medformer's superiority over 10 baselines, achieving top averaged ranking across five datasets on all six evaluation metrics, and underscore the significant impact of the method on healthcare applications, such as diagnosing Myocardial Infarction, Alzheimer's, and Parkinson's disease.

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.
Paper Structure (25 sections, 7 equations, 4 figures, 7 tables)

This paper contains 25 sections, 7 equations, 4 figures, 7 tables.

Figures (4)

  • Figure 1: Token embedding methods. Vanilla transformer, Autoformer, and Informer vaswani2017attentionwu2021autoformerzhou2021informer employ a single cross-channel timestamp as a token; iTransformer liu2023itransformer utilizes an entire channel as a token; and PatchTST and Crossformer nie2022timezhang2022crossformer adopt a patch of timestamps from one channel as a token. For MedTS classification, we propose Medformer considering inter-channel dependencies (cross-channel), temporal properties (multi-timestamp), and multifaceted scale of temporal patterns (multi-granularity).
  • Figure 2: Subject-dependent/independent setups (figure adopted from our previous work wang2024contrast). 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 the training or test set, which is more challenging and practically meaningful but less studied.
  • Figure 3: Overview of Medformer. a) Workflow. b) For the input sample $\bm{x}_{\textrm{in}}$, we apply $n$ distinct patch lengths in parallel to create patched features $\bm{x}_p^{(i)}$, where $i$ ranges from 1 to $n$. Each patch length represents a unique granularity. These patches are then projected into $\bm{x}_e^{(i)}$ and subsequently augmented to form $\widetilde{\bm{x}}_e^{(i)}$. c) We obtain the final embedding $\bm{x}^{(i)}$ by combining the augmented $\widetilde{\bm{x}}_e^{(i)}$ with both the positional embedding $\bm{W}_{\text{pos}}$ and the granularity embedding $\bm{W}_{\text{gr}}^{(i)}$. Additionally, a granularity-specific router $\bm{u}^{(i)}$ is designed to capture integrated information for each respective granularity. We then perform intra-granularity self-attention, focusing on individual granularities, and inter-granularity self-attention, using the routers to facilitate communication across different granularities.
  • Figure 4: Average Rank of Subject-Independent Setup. The heatmap table shows the average rank of Medformer and 10 baselines across 5 datasets using the subject-independent setup. A lower number indicates better results. The average rank is calculated across the 5 datasets to obtain the overall average rank.