How To Evaluate Your Medical Time Series Classification?

## Abstract

Abstract Medical time series (MedTS) play a critical role in many healthcare applications, such as vital sign monitoring and the diagnosis of brain and heart diseases.
However, the existence of subject-specific features poses unique challenges in MedTS evaluation.
Inappropriate evaluation setups that either exploit or overlook these features can lead to artificially inflated classification performance (by up to 50% in accuracy on ADFTD dataset): this concern has received little attention in current research.
Here, we categorize the existing evaluation setups into two primary categories: subject-dependent and subject-independent.
We show the subject-independent setup is more appropriate for different datasets and tasks. Our theoretical analysis explores the feature components of MedTS, examining how different evaluation setups influence the features that a model learns. Through experiments on six datasets (spanning EEG, ECG, and fNIRS modalities) using four different methods, we demonstrate step-by-step how subject-dependent utilizes subject-specific features as a shortcut for classification and leads to a deceptive high performance, suggesting that the subject-independent setup is more precise and practicable evaluation setup in real-world. This comprehensive analysis aims to establish clearer guidelines for evaluating MedTS models in different healthcare applications. Code to reproduce this work in https://github.com/DL4mHealth/MedTS_Evaluation .

## 1 Introduction

Figure: Figure 1: Types of MedTS Datasets. S and C denote subject and class, respectively.
Refer to caption: x1.png

Medical time series (MedTS) are specialized time series data representing continuous recordings of physiological signals from human subjects Wang et al. (), including EEG, ECG, fNIRS, and PPG signals Badr et al. (); Liu et al. (); Eastmond et al. (); Esgalhado et al. ().

We propose a taxonomy for MedTS evaluation based on dataset composition and subject dependency.
Compared to general time series, MedTS contain additional subject-specific information, as they are physiological data collected from human subjects and are associated with subject IDs alongside the ground truth labels Wang et al. ().
This subject-specific information, along with each subject’s medical state, allows us to categorize the MedTS dataset into three types based on the number of subjects and the medical classes per subject (Figure 1): single-subject and multi-class, multi-subject and multi-class, and multi-subject and single-class.
For simplicity, we denote them as Type-I, Type-II, and Type-III MedTS datasets respectively.
Here, the distinction between single/multi-class for a subject indicates whether the subject’s medical state is fixed or dynamic over time. See detailed explanations and real-world examples in Section 2.1.
Depending on the type of MedTS, various tasks can be designed for real-world medical applications, including health monitoring Jafari et al. (), disease diagnosis Kiyasseh et al. (), and brain-computer-interface (BCI) Altaheri et al. ().

We categorize existing MedTS evaluation setups into two primary groups (Section 2.2, Figure 2): Subject-Dependent Ieracitano et al. (); Arif et al. () and Subject-Independent Nath et al. (); Kiyasseh et al. (). In the Subject-Dependent setup, the training, validation, and test sets are split similarly to general time series classification, where samples could be assigned any of the into these three sets. This approach allows samples with the same subject ID to appear in multiple sets simultaneously. In contrast, the Subject-Independent setup addresses subject-specific information by splitting the data based on subjects, ensuring that samples from the same subject appear exclusively in either the training, validation, or test set.

Figure: (a) Types of Evaluation Setups
Refer to caption: x2.png

However, the inherent subject-specific information in MedTS introduces unique challenges that do not exist in general time series classification problems. As observed in various MedTS classification tasks, such as disease diagnosis, different evaluation setups can lead to widely varying performance outcomes Nath et al. (); Seal et al. (). For example, the subject-independent setting achieves a 50.65% F1 score on the ADFTD dataset, which is 46.85% lower than the subject-dependent setting Wang et al. ()! A general explanation for these performance differences is that the model overfits subject-specific features instead of learning common features across subjects Arif et al. (); Wang et al. (). However, no study has thoroughly quantified how much models depend on subject-specific features in the subject-dependent setup.

Intuitively, researchers should use the subject-independent setup when evaluating MedTS datasets, as it better mirrors real-world conditions where models must generalize to unseen patients. In practice, it is unrealistic and problematic for a model to be trained on data from the same subjects that appear in the test set, as this leads to overfitting on subject-specific features rather than learning patterns that generalize across different subjects. Consequently, the subject-independent setup provides a more rigorous and reliable measure of a model’s performance in medical time series classification. However, many studies are still evaluating MedTS in subject-dependent setup, which is problematic.

In this paper, we empirically demonstrate the impact of the subject-dependent setup on learning subject-specific features and how these features influence model performance in Type-III MedTS disease diagnosis tasks.
By randomly shuffling the ground truth labels while retaining the original subject IDs, we train models under both the subject-dependent and subject-independent setups.
This procedure effectively removes disease-related features, ensuring that the model can only rely on subject-specific features to classify labels. By observing the performance changes, we assess the influence of subject-specific features on overall model performance.

We conduct experiments on six MedTS datasets, including three EEG datasets, two ECG datasets, and one fNIRS dataset. We train four different models on these datasets to broadly verify our assumptions.
The results reveal that, for certain datasets such as ADFTD and PTB, the model’s performance under the subject-dependent setup barely declined—from 97.56% to 97.12% and 99.90% to 99.69% in F1 score, respectively, using Medformer Wang et al. ()—even after we completely removed the disease-related features across subjects. These results strongly indicate that it is possible for a model to learn virtually nothing about disease-related features while achieving deceptively high performance by leveraging subject-specific features as a shortcut in the subject-dependent setup. Even increasing the number of subjects could not entirely eliminate this effect. For instance, in the larger PTB-XL dataset, the performance drops from 88.02% F1 score to 71.15% when disease-related features are removed under the subject-dependent setup using Medformer. Yet, this score remained much higher than the 59.97% F1 score obtained in the subject-independent setup. This finding underscores that subject-specific features can significantly inflate performance metrics, even in datasets with a large number of subjects, emphasizing the importance of using subject-independent setups for a more realistic evaluation setup in any tasks that aims to learn cross-subject features, such as disease-related features in Type-III MedTS.

## 2 Taxonomy of MedTS Datasets and Evaluation Setups

### 2.1 Types of Medical Time Series Dataset

We categorize MedTS datasets into three types below based on the number of subjects and classes:

(1) Single-Subject and Multi-Class (Type-I). This type of MedTS is typically used to develop models tailored to a specific subject. Examples include designing brain-computer interfaces for individuals with disabilities Musk et al. (); Scherer et al. () or building personalized health monitoring systems (Levett et al., ) using wearable devices. In these scenarios, the model focuses on learning from the time-varying classes generated by a single subject’s data over time.

(2) Multi-Subject and Multi-Class (Type-II). The second type is used to design general models that can adapt to multiple subjects with varying classes. For instance, mental state recognition systems (Jafari et al., ; Li et al., ; Dai et al., ; Zhang et al., ) or sleep state classification systems (Eldele et al., ; Mousavi et al., ) fall under this category. In this case, the MedTS samples from different subjects are associated with dynamically changing classes over time, meaning no fixed class is assigned to each subject.

(3) Multi-Subject and Single-Class (Type-III). In the third type, each subject is assigned a single class that remains consistent over time. For example, once a subject is diagnosed with Alzheimer’s Disease during the data collection stage, this subject is always classified as an AD patient. This type of MedTS is often used as a low-cost diagnostic method to supplement or replace more traditional medical approaches Miltiadous et al. (); van Dijk et al. (); Wagner et al. ().
It is important to clarify that the term "single-class" here refers to cases where the medical or physiological state of a subject remains fixed over time (or within a short period without significant change). For example, a patient diagnosed with Alzheimer’s Disease (AD) will typically remain in that state for decades after the diagnosis. However, a subject may also have multiple coexisting medical conditions, such as both Alzheimer’s and Parkinson’s Disease. This scenario represents a multi-label problem in the medical domain (Zhou et al., ), which falls outside the scope of this work.

### 2.2 MedTS Evaluation Setups

We categorize the commonly used evaluation setups in existing MedTS classification studies into two main types below (Figure 2). (Seal et al., ; Wang et al., ).

(1) Subject-Dependent. Samples from different subjects are randomly shuffled and split into training, validation, and test sets, allowing the same subject’s data to appear in all three sets. Depending on whether a causal split is applied, the subject-dependent setup can be further divided into two subtypes:
Mixed (random split): The splitting of samples from each subject does not account for causal relationships; instead, samples are randomly mixed Dai et al. (); Sarkar et al. (); Seal et al. (). This means that stratification occurs without regard for temporal order.
Causal (temporal split): The split considers the temporal relationship in the time series for each subject, the past samples included in the training set, and future samples placed in the validation and test sets. This causal setup is necessary for time series forecasting tasks Wu et al. (); Zhou et al. (); Liu et al. () but is rarely adopted in existing time series classification tasks. We discuss the implications of the causal-subject-dependent setup in more detail in Section 4.3.

(2) Subject-Independent. The training, validation, and test sets are split by subjects, ensuring that samples from the same subject ID are exclusively included only in one of the three sets.
Subject-independent setup can be further divided into two subtypes:
Leave-One-Out: Leave only one subject for testing, while all other subjects are used for training Zhang et al. (); Li et al. (); Miltiadous et al. ().
Due to the limited sample size of a single subject, cross-validation is generally necessary to avoid biased evaluations. However, this setup does not include a dedicated validation set, which can lead to overfitting.
Leave-N-Out: Leave $N$ subjects for validation and/or test sets Ahmed et al. (); Pandey & Seeja (); Wang et al. (). In this setup, a larger pool of subjects is used for testing, making it more robust than the leave-one-out approach.

In the evaluation setups, the inclusion of a validation set and cross-validation are optional but strongly recommended for real-world applications to ensure a comprehensive and reliable evaluation. Here, we do not consider the impact of data imbalance.

## 3 Method

This paper mainly discusses the Type-III MedTS dataset, characterized by multiple subjects with a single class assigned per subject, as categorized in section 2.1 and illustrated in Figure 1. For the Type-II MedTS datasets and their evaluation setups, we briefly discuss them in the section 4.3 in experiments later and leave a more detailed analysis to future works.
We discussed Type-I datasets in Appendix C but did not conduct experiments due to the lack of public datasets with sufficient data from a single subject, which is necessary for Type-I experiments where the training set includes only one subject and requires a large sample size.

In this section, we first introduce our notations and assumptions for describing the feature components of Type-III MedTS. Next, we analyze the subject-dependent and subject-independent setups in the context of feature components utilized in the Type-III MedTS classification tasks. Finally, we propose several new experimental setups based on these two setups to validate our assumptions systematically.

### 3.1 Notations and Assumptions of Type-III MedTS Dataset

Given a Type-III MedTS sample $\bm{x}\in\mathbb{R}^{T\times C}$, where $T$ denotes the number of timestamps and $C$ represents the number of channels, the sample is associated with a corresponding disease-related label $\bm{y}\in\mathbb{R}^{K}$. Here, $K$ indicates the number of medically relevant classes, such as different disease types. Each sample is also assigned to a subject ID $\bm{z}\in\mathbb{R}$, identifying the subject to which it belongs.

In time series forecasting tasks, researchers commonly decompose data into trend and seasonal feature components and design mechanisms to effectively leverage these components for improved representation learning Wu et al. (); Wang et al. (); Fraikin et al. (). Similarly, Type-III MedTS data also have several distinct feature components. We assume that a Type-III MedTS sample $\bm{x}$ consists of three feature components:

$$ $\displaystyle\bm{x}=$ $\displaystyle\bm{x}^{d}+\bm{x}^{s}+\bm{x}^{o}$ (1) $$

where $\bm{x}^{d}$ represents disease-related features, $\bm{x}^{s}$ denotes subject-specific features, and $\bm{x}^{o}$ includes all other features, such as noise, artifacts, and all task-irrevalent features. In Type-III MedTS learning for disease diagnosis tasks, our goal is to train a model $f_{\theta}:\bm{x}\rightarrow\bm{y}$ that accurately maps a given sample $\bm{x}$ to its corresponding disease-related label $\bm{y}$.

**Table 1: Feature Components Utilization of Setups. The table provides an overview of the feature components utilized by a trained model $f_{\theta}$ when classifying a given Type-III MedTS sample $\bm{x}$ during the validation/test stages across five experimental setups, along with their corresponding classification tasks. The setups include subject-dependent(Sub-Dep), subject-independent(Sub-Inep), subject-discrimination(Sub-Disc), random-label subject-dependent(R-Sub-Dep), and random-label subject-independent(R-Sub-Indep). There are three feature components considered: disease-related features $\bm{x}^{d}$, subject-specific features $\bm{x}^{s}$, and all other features $\bm{x}^{o}$. The classification tasks involve predicting either the label $\bm{y}$ or the subject ID $\bm{z}$ of a sample.**
|  | Feature Components Utilization | Classification Tasks |  |  |  |
| --- | --- | --- | --- | --- | --- |
| Setups | $\bm{x}^{d}$<br>(Disease) | $\bm{x}^{s}$<br>(Subject) | $\bm{x}^{o}$<br>(Other) | $\bm{y}$<br>(Label) | $\bm{z}$<br>(Subject ID) |
| Sub-Dep | ✓ | ✓ | ✓ | ❍ |  |
| Sub-Indep | ✓ |  | ✓ | ❍ |  |
| Sub-Disc |  | ✓ | ✓ |  | ❍ |
| R-Sub-Dep |  | ✓ | ✓ | ❍ |  |
| R-Sub-Indep |  |  | ✓ | ❍ |  |

However, in the context of disease diagnosis using Type-III MedTS, the choice between subject-dependent and subject-independent setups can result in significant disparities in model performance Nath et al. (); Seal et al. (); Wang et al. (). We aim to learn a model using disease-related features $\bm{x}^{d}$ to achieve accurate classification. Ideally, the model $f_{\theta}$ should rely solely on $\bm{x}^{d}$ and be entirely independent of subject-specific features $\bm{x}^{s}$
when predicting the label $\bm{y}$.

Given the unique nature of Type-III MedTS data, where samples with the same subject ID $\bm{z}$ always share the same label $\bm{y}$, but samples with the same label $\bm{y}$ do not necessarily share the same subject ID $\bm{z}$, there is a risk that the model $f_{\theta}$ might exploit subject-specific features $\bm{x}^{s}$ as a shortcut for predicting $\bm{y}$, rather than learning the disease-related features $\bm{x}^{d}$. Although some existing studies have attempted to address this issue and propose methods to tackle it, effectively decomposing $\bm{x}^{d}$ and $\bm{x}^{s}$ from $\bm{x}$ remains an open challenge Zhang et al. (); Yang et al. (); Wang et al. ().

To summarize, we assume that subject-specific features $\bm{x}^{s}$ exist in each sample $\bm{x}$ within the Type-III MedTS dataset, and it is possible for the trained model $f_{\theta}$ to utilize $\bm{x}^{s}$ as a shortcut for classifying the label $\bm{y}$ under the subject-dependent setup. This could result in deceptively high performance while the model learns little to nothing about the disease-related features $\bm{x}^{d}$.

### 3.2 Feature Components Utilized in Subject-Dependent vs Independent

We analyze the differences of two setups from the perspective of feature components used when classifying a Type-III MedTS sample $\bm{x}$. Their feature components utilization are presented in table 1.

a) Subject-Dependent.
The subject-dependent setup disregards the subject ID, treating the Type-III MedTS classification problem similarly to general time series classification. Samples from different subjects within the dataset are shuffled, mixed, and randomly divided into training, validation, and test sets. Samples sharing the same subject ID can be present inclusively in these three sets.

In this scenario, for a given sample $\bm{x}$ in the validation/test set, the trained model $f_{\theta}$ could leverage both its disease-related features $\bm{x}^{d}$ and subject-specific features $\bm{x}^{s}$ to predict the label $\bm{y}$.
This happens because the model $f_{\theta}$ gains access to disease-related features by learning from training samples with the same label $\bm{y}$ and simultaneously acquires subject-specific features by learning from training samples with the same subject ID $\bm{z}$. Consequently, this setup can lead to an overestimation of the model’s performance, as it can exploit subject-specific information rather than generalizing based on disease-related features alone.

b) Subject-Independent.
The subject-independent setup considers the effect of subject-specific features and closely simulates real-world applications. In this setup, the training, validation, and test sets are split based on subjects rather than individual samples, ensuring that all samples from a particular subject (i.e., with the same subject ID) are exclusively included in one of the three sets.

In this scenario, for any given sample $\bm{x}$ in the validation/test set, the trained model $f_{\theta}$ can only leverage the disease-related features $\bm{x}^{d}$ to predict the label $\bm{y}$, as no samples with the same subject ID $\bm{z}$ are present in the training set. This setup aligns with real-world applications of disease diagnosis using Type-III MedTS, where a label is assigned to an entire subject, and it’s impractical to have access to labeled samples from that subject in advance during training.

However, this setup often faces several challenges and can sometimes exhibit poor performance. Firstly, while the subject independent setup prevents model $f_{\theta}$ from exploiting subject-specific features $\bm{x}^{s}$ as a shortcut for classification during validation and testing, it remains possible for the model to rely on subject-specific features during the training stage, impeding its ability to learn task-related subject-invariant features. Secondly, from a domain generalization perspective, different subjects can be considered distinct domains, making it challenging to efficiently extract disease-related features that generalize well across unseen domains (i.e., subjects in the validation/test sets). Currently, there are no effective methods to decompose subject-specific and disease-related features during the training stage fully. This remains an open challenge in the field.

### 3.3 New Experimental Setups to Validate Assumptions

To demonstrate that subject-specific features are universally present in Type-III MedTS datasets, we first introduce the subject-discrimination setup to identify these features. Following this, we design two additional setups—random-label subject-dependent and random-label subject-independent—to manually remove the disease-related features from the dataset. These setups allow us to validate our assumption that models trained under the subject-dependent setup heavily rely on subject-specific features as a shortcut for label classification. The feature components utilized and classification tasks for three new setups are present in table 1.

a) Subject-Discrimination. The disease label $\bm{y}$ of a subject in a MedTS dataset is assigned by medical experts, ensuring that disease-related features $\bm{x}^{d}$ are present in the MedTS samples for that subject. However, there is no guarantee that subject-specific features $\bm{x}^{s}$ exist, although researchers usually assume they exist. To investigate the presence of subject-specific features $\bm{x}^{s}$ for samples in each subject, we design this setup to prove the existence of subject-specific features by trying to classify the subject ID $\bm{z}$ of samples.

In this experiment, we randomly shuffle, mix, and split all samples into training, validation, and test sets. We then train a model $f_{\theta}$ to predict the subject ID $\bm{z}$ of a given sample $\bm{x}$. Since the model is not provided with the disease label $\bm{y}$ during training, and given that the number of subjects is typically much larger than the number of disease labels, the model cannot rely on disease-related features $\bm{x}^{d}$ as a shortcut for subject ID classification. Therefore, if the model performs well in classifying the subject ID $\bm{z}$, it strongly indicates the existence of subject-specific features $\bm{x}^{s}$ within the dataset.

b) Random-Label Subject-Dependent. Previous research has consistently shown that models evaluated under the subject-dependent setup generally achieve much higher performance compared to the subject-independent setup Nath et al. (); Arif et al. (); Wang et al. (). While it is widely assumed that the model under the subject-dependent setup exploits subject-specific features $\bm{x}^{s}$ as a shortcut for classifying the label $\bm{y}$, the extent of the model’s reliance on $\bm{x}^{s}$ and whether it still learns disease-related features $\bm{x}^{d}$ remains unclear. To investigate the clear influence of subject-specific features $\bm{x}^{s}$ on model performance, we introduce the random-label subject-dependent setup.

This setup differs slightly from the original subject-dependent setup. We retain the subject ID but randomly shuffle the label of each subject before splitting the samples into training, validation, and test sets. This operation disrupts the relationship between disease-related features $\bm{x}^{d}$ and the label $\bm{y}$, effectively preventing the model $f_{\theta}$ from leveraging $\bm{x}^{d}$ for prediction.

As a result, in the random-label subject-dependent setup, the trained model $f_{\theta}$ can rely solely on subject-specific features $\bm{x}^{s}$ to predict the label $\bm{y}$ for any given sample $\bm{x}$. By comparing the performance of the random-label subject-dependent setup with the original subject-dependent setup, we can directly assess the extent to which the model relies on subject-specific features $\bm{x}^{s}$ as a shortcut and evaluate how much it learns disease-related features $\bm{x}^{d}$.

**Table 2: The information for the processed datasets. The table shows the number of subjects, samples, classes, channels, sampling rate, sample timestamps, type of MedTS, and file size. Here, #-Timestamps indicates the number of timestamps per sample.**
| Datasets | #-Subject | #-Sample | #-Class | #-Channel | #-Timestamps | Sampling Rate | MedTS-Type | File Size |
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
| ADFTD | 88 | 69,752 | 3 | 19 | 256 | 256Hz | Type-III | 2.52GB |
| TDBrain | 72 | 6,240 | 2 | 33 | 256 | 256Hz | Type-III | 571MB |
| PTB | 198 | 64,356 | 2 | 15 | 300 | 250Hz | Type-III | 2.15GB |
| PTB-XL | 17,596 | 191,400 | 5 | 12 | 250 | 250Hz | Type-III | 4.28GB |
| EEGMMIDB | 106 | 9236 | 3 | 64 | 640 | 160Hz | Type-II | 2.82GB |
| WG-fNIRS | 26 | 9360 | 2 | 72 | 25 | 10Hz | Type-II | 129MB |

c) Random-Label Subject-Independent. Similar to the random-label subject-dependent setup, we apply the same process in the subject-independent setup, where we randomly shuffle the label of each subject while retaining their subject IDs before splitting the data into training, validation, and test sets. This ensures that the model $f_{\theta}$ cannot learn any disease-related features $\bm{x}^{d}$.

The random-label subject-independent setup serves as a control for the random-label subject-dependent setup, enabling us to isolate the potential impact of other features $\bm{x}^{o}$. In this setup, the model is unable to utilize either disease-related features $\bm{x}^{d}$ or subject-specific features $\bm{x}^{s}$ to classify the label $\bm{y}$; instead, it can only rely on other features $\bm{x}^{o}$. In other words, if the other features $\bm{x}^{o}$ are independent of the label $\bm{y}$, the performance under the random-label subject-independent setup should be completely random.

## 4 Experiments

To make the experimental scenarios more robust and pervasive, we train on four different models: Multi-Layer Perception (MLP) Popescu et al. (), Temporal Convolutional Neural Networks (TCN)  Bai et al. (), vanilla Transformer Vaswani et al. (), and Medformer Wang et al. (), to cover different architectures from MLP, CNN, to transformers. The implementation details of four methods are presented in Appendix B. We evaluate six MedTS datasets, including three EEG datasets, ADTFD (Miltiadous et al., ), TDBrain van Dijk et al. (), and EEGMMIDB Schalk et al. (), and two ECG datasets, PTB PhysioBank () and PTB-XL Wagner et al. (), and one fNIRS datasets, WG-fNIRS Shin et al. (). The data processing processes are presented in Appendix A. The information of processed datasets is listed in Table 2.
We employ two key evaluation metrics: accuracy and F1 score (macro-averaged). The training process is conducted with five random seeds (41-45) to compute the mean and standard deviation of the models. All experiments are run on an NVIDIA RTX 4090 GPU and a server with 4 RTX A5000 GPUs.

Unless otherwise specified in this section, the subject-dependent setup refers to the mix-subject-dependent setup, and the subject-independent setup refers to the leave-N-out subject-independent setup, as categorized in section 2.2. Experimental section 4.1 and  4.2 systematically prove our assumptions of Type-III MedTS datasets analyzed in section 3. We also briefly present some results and findings from evaluating Type-II MedTS datasets using different subject-dependent sub-types to show the influence of the causal-split in section 4.3, leaving more detailed analysis for future work.

### 4.1 Results of Subject-Dependent and Subject-Independent On Type-III MedTS

**Table 3: Results comparison of Type-III MedTS datasets evaluated under subject-dependent(Sub-Dep) and subject-independent(Sub-Indep) setups. The model’s performance under the subject-dependent setup consistently exceeds the subject-independent setup across all datasets and models.**
| Models | MLP | TCN | Transformer | Medformer |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Datasets | Setups | Accuracy | F1 Score | Accuracy | F1 Score | Accuracy | F1 Score | Accuracy | F1 Score |
| ADFTD<br>(3-Classes) | Sub-Dep | 58.66$\pm$0.61 | 55.48$\pm$0.44 | 81.42$\pm$0.49 | 80.25$\pm$0.54 | 97.00$\pm$0.43 | 96.86$\pm$0.44 | 97.66$\pm$0.76 | 97.56$\pm$0.79 |
| Sub-Indep | 49.10$\pm$1.01 | 43.78$\pm$0.28 | 50.46$\pm$1.35 | 47.32$\pm$1.27 | 50.47$\pm$2.14 | 48.09$\pm$1.59 | 52.37$\pm$1.51 | 48.72$\pm$1.18 |  |
| TDBrain<br>(2-Classes) | Sub-Dep | 81.93$\pm$0.26 | 80.16$\pm$0.29 | 97.32$\pm$0.28 | 97.16$\pm$0.30 | 97.60$\pm$0.19 | 97.45$\pm$0.21 | 96.70$\pm$0.42 | 96.51$\pm$0.45 |
| Sub-Indep | 69.42$\pm$0.64 | 69.37$\pm$0.64 | 83.98$\pm$2.31 | 83.93$\pm$2.35 | 86.58$\pm$0.76 | 86.52$\pm$0.79 | 83.92$\pm$1.01 | 83.69$\pm$1.09 |  |
| PTB<br>(2-Classes) | Sub-Dep | 99.80$\pm$0.02 | 99.63$\pm$0.03 | 99.95$\pm$0.01 | 99.91$\pm$0.03 | 99.92$\pm$0.02 | 99.86$\pm$0.04 | 99.94$\pm$0.02 | 99.90$\pm$0.05 |
| Sub-Indep | 77.76$\pm$0.46 | 70.02$\pm$0.60 | 83.97$\pm$2.26 | 78.99$\pm$3.44 | 77.37$\pm$1.02 | 68.47$\pm$2.19 | 77.86$\pm$1.64 | 69.93$\pm$2.69 |  |
| PTB-XL<br>(5-Classes) | Sub-Dep | 66.99$\pm$0.10 | 52.98$\pm$0.24 | 88.61$\pm$0.42 | 85.21$\pm$0.73 | 87.86$\pm$0.32 | 84.50$\pm$0.41 | 90.48$\pm$0.24 | 88.02$\pm$0.33 |
| Sub-Indep | 66.16$\pm$0.16 | 51.13$\pm$0.20 | 73.30$\pm$1.00 | 62.10$\pm$0.29 | 71.13$\pm$0.33 | 59.58$\pm$0.55 | 71.37$\pm$0.44 | 59.97$\pm$0.41 |  |

Setup. We begin by comparing the results between the subject-dependent and subject-independent setups. In the subject-dependent setup, the training, validation, and test sets are split based on individual samples, allowing samples with the same subject ID to be present in all three sets simultaneously. In contrast, the subject-independent setup splits these sets based on subjects, ensuring that samples with the same subject ID are exclusively included in only one of the three sets. As discussed in Section 3.2, for a given sample $\bm{x}$, a trained model $f_{\theta}$ following the subject-dependent setup can leverage both disease-related features $\bm{x}^{d}$ and subject-specific features $\bm{x}^{s}$ to classify the label $\bm{y}$. However, in the subject-independent setup, the trained model $f_{\theta}$ can rely solely on the disease-related features $\bm{x}^{d}$ for classification. By comparing the results between these two setups, we can gain insights into how subject-specific features influence the model’s performance.

Results. The results are summarized in Table 3, where "Sub-Dep" and "Sub-Indep" refer to the subject-dependent and subject-independent setups, respectively. For each dataset, we highlight in bold the best-performing result across the four methods within each setup. Across all datasets, it’s evident that the subject-dependent setup consistently outperforms the subject-independent setup, regardless of the training method used. The performance gap between the subject-dependent and subject-independent setups varies across different datasets. For instance, when using the Medformer model, the F1 score difference between two setups is approximately 50% F1 score for the ADFTD dataset, but only around 13% F1 score for the TDBrain dataset. This variation suggests that the ratio of disease-related features $\bm{x}^{d}$ to subject-specific features $\bm{x}^{s}$ differs across datasets.

### 4.2 Results of Three New Experimental Setups on Type-III MedTS

In this section, we perform experiments using three newly designed setups: subject-discrimination, random-label subject-dependent, and random-label subject-independent. These experiments aim to analyze and verify the assumptions outlined in the method section 3.

#### 4.2.1 Results of Subject-Discrimination

**Table 4: The results of Type-III datasets evaluated under the subject-discrimination(Sub-Disc) setup are summarized in the table. This setup aims to verify the existence of subject-specific features in the datasets. The high performance observed across all four datasets supports this assumption, indicating that subject-specific features $\bm{x}^{s}$ are present.**
| Models | MLP | TCN | Transformer | Medformer |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Datasets | Setups | Accuracy | F1 Score | Accuracy | F1 Score | Accuracy | F1 Score | Accuracy | F1 Score |
| ADFTD<br>(88-Subjects) | Sub-Disc | 30.89$\pm$0.66 | 30.90$\pm$0.61 | 86.31$\pm$1.60 | 86.10$\pm$1.59 | 98.15$\pm$0.49 | 98.00$\pm$0.52 | 98.78$\pm$0.16 | 98.72$\pm$0.17 |
| TDBrain<br>(72-Subjects) | Sub-Disc | 29.78$\pm$0.73 | 28.83$\pm$0.73 | 58.23$\pm$4.03 | 56.92$\pm$4.42 | 80.93$\pm$1.78 | 80.14$\pm$1.83 | 86.93$\pm$1.50 | 86.56$\pm$1.58 |
| PTB<br>(198-Subjects) | Sub-Disc | 99.16$\pm$0.02 | 99.21$\pm$0.05 | 99.68$\pm$0.03 | 99.68$\pm$0.03 | 99.54$\pm$0.03 | 99.60$\pm$0.04 | 99.64$\pm$0.04 | 99.66$\pm$0.04 |
| PTB-XL<br>(17,596-Subjects) | Sub-Disc | 5.32$\pm$0.13 | 4.68$\pm$0.11 | 84.04$\pm$2.39 | 84.35$\pm$2.18 | 69.92$\pm$1.51 | 68.01$\pm$1.67 | 78.27$\pm$0.50 | 76.64$\pm$0.53 |

Setup. The subject-discrimination setup is similar to the subject-dependent setup in that we randomly shuffle, mix, and split all samples into training, validation, and test sets, allowing samples with the same subject ID to be present in all three sets simultaneously. However, the classification task in this setup is shifted from predicting the label $\bm{y}$ to identifying the subject ID $\bm{z}$. The primary goal of this setup is to confirm the existence of subject-specific features $\bm{x}^{s}$ within a dataset and to assess their strength based on the model’s classification performance. As discussed in Section 3.3, when validating or testing a given sample $\bm{x}$, the trained model $f_{\theta}$ is unable to rely on disease-related features $\bm{x}^{d}$ as shortcuts for subject ID $\bm{z}$ classification, since there is typically a one-to-many relationship between disease label $\bm{y}$ and subject ID $\bm{z}$. In rare cases where a dataset of two subjects has opposite labels, the model $f_{\theta}$ might theoretically use disease-related features $\bm{x}^{d}$ as a shortcut to classify the subject ID $\bm{z}$. However, this scenario does not apply to the datasets used in this paper, where the number of subjects far exceeds the number of labels.

Results. The results of the subject-discrimination setup are presented in Table 4. The highest F1 scores across the four methods are 98.72%, 86.56%, 99.68%, and 84.35% for the ADFTD, TDBrain, PTB, and PTB-XL datasets, respectively. The performance for ADFTD and PTB is remarkably high, approaching an F1 score of 100%, indicating that these two datasets has very strong subject-specific features. Even for the larger PTB-XL dataset, which includes 17,596 subjects, the model still achieved an F1 score exceeding 80%. Overall, these results provide compelling evidence for the existence of subject-specific features across all four datasets, with some datasets, like ADFTD and PTB, exhibiting very strong subject-specific features, while others, like TDBrain and PTB-XL, display relatively weaker but still significant subject-specific characteristics.

#### 4.2.2 Results of Random-Label Subject-Dependent

**Table 5: The results of Type-III MedTS datasets evaluated under the random-label subject-dependent(R-Sub-Dep). For comparison, we also include the results of the subject-dependent(Sub-Dep) and subject-discrimination(Sub-Disc) setups in the table. The negligible performance drop from the subject-dependent to the random-label subject-dependent setup of ADFTD and PTB indicates that the model learns almost nothing about disease-related features $\bm{x}_{d}$ during training under the subject-dependent setup for these two datasets.**
| Models | MLP | TCN | Transformer | Medformer |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Datasets | Setups | Accuracy | F1 Score | Accuracy | F1 Score | Accuracy | F1 Score | Accuracy | F1 Score |
| ADFTD<br>(3-Classes) | Sub-Dep | 58.66$\pm$0.61 | 55.48$\pm$0.44 | 81.42$\pm$0.49 | 80.25$\pm$0.54 | 97.00$\pm$0.43 | 96.86$\pm$0.44 | 97.66$\pm$0.76 | 97.56$\pm$0.79 |
| R-Sub-Dep | 46.33$\pm$1.48 | 45.88$\pm$1.41 | 75.16$\pm$1.68 | 75.00$\pm$1.82 | 96.99$\pm$0.29 | 96.97$\pm$0.29 | 97.14$\pm$0.74 | 97.12$\pm$0.74 |  |
| Sub-Disc | 30.89$\pm$0.66 | 30.90$\pm$0.61 | 86.31$\pm$1.60 | 86.10$\pm$1.59 | 98.15$\pm$0.49 | 98.00$\pm$0.52 | 98.78$\pm$0.16 | 98.72$\pm$0.17 |  |
| TDBrain<br>(2-Classes) | Sub-Dep | 81.93$\pm$0.26 | 80.16$\pm$0.29 | 97.32$\pm$0.28 | 97.16$\pm$0.30 | 97.60$\pm$0.19 | 97.45$\pm$0.21 | 96.70$\pm$0.42 | 96.51$\pm$0.45 |
| R-Sub-Dep | 63.40$\pm$2.22 | 62.42$\pm$2.29 | 89.88$\pm$2.26 | 89.71$\pm$2.21 | 86.88$\pm$1.26 | 86.65$\pm$1.35 | 86.17$\pm$2.71 | 85.95$\pm$2.72 |  |
| Sub-Disc | 29.78$\pm$0.73 | 28.83$\pm$0.73 | 58.23$\pm$4.03 | 56.92$\pm$4.42 | 80.93$\pm$1.78 | 80.14$\pm$1.83 | 86.93$\pm$1.50 | 86.56$\pm$1.58 |  |
| PTB<br>(2-Classes) | Sub-Dep | 99.80$\pm$0.02 | 99.63$\pm$0.03 | 99.95$\pm$0.01 | 99.91$\pm$0.03 | 99.92$\pm$0.02 | 99.86$\pm$0.04 | 99.94$\pm$0.02 | 99.90$\pm$0.05 |
| R-Sub-Dep | 99.44$\pm$0.02 | 99.44$\pm$0.03 | 99.83$\pm$0.03 | 99.83$\pm$0.03 | 99.64$\pm$0.11 | 99.64$\pm$0.11 | 99.69$\pm$0.04 | 99.69$\pm$0.04 |  |
| Sub-Disc | 99.16$\pm$0.02 | 99.21$\pm$0.05 | 99.68$\pm$0.03 | 99.68$\pm$0.03 | 99.54$\pm$0.03 | 99.60$\pm$0.04 | 99.64$\pm$0.04 | 99.66$\pm$0.04 |  |
| PTB-XL<br>(5-Classes) | Sub-Dep | 66.99$\pm$0.10 | 52.98$\pm$0.24 | 88.61$\pm$0.42 | 85.21$\pm$0.73 | 87.86$\pm$0.32 | 84.50$\pm$0.41 | 90.48$\pm$0.24 | 88.02$\pm$0.33 |
| R-Sub-Dep | 21.62$\pm$0.15 | 21.58$\pm$0.13 | 72.55$\pm$0.39 | 72.54$\pm$0.39 | 62.53$\pm$2.07 | 62.52$\pm$2.07 | 71.16$\pm$1.58 | 71.15$\pm$1.58 |  |
| Sub-Disc | 5.32$\pm$0.13 | 4.68$\pm$0.11 | 84.04$\pm$2.39 | 84.35$\pm$2.18 | 69.92$\pm$1.51 | 68.01$\pm$1.67 | 78.27$\pm$0.50 | 76.64$\pm$0.53 |  |

Setup. The random-label subject-dependent setup builds upon the subject-dependent setup with an additional step. Before shuffling and splitting all samples into training, validation, and test sets, we first randomly assign a new label to each subject. For instance, in the ADFTD dataset, which has three classes (0, 1, and 2) representing different medical conditions, we randomly assign each subject a new label from these three classes, replacing their true label. The purpose of this setup is to deliberately mask the disease-related features in the dataset, ensuring that the trained model $f_{\theta}$ theoretically cannot learn any disease-related features during training. As a result, the model can only rely on subject-specific features to classify the label $\bm{y}$ of a given sample $\bm{x}$ during the validation and test stages. The performance drop observed in this setup compared to the original subject-dependent setup will indicate the extent to which the model learned disease-related features in the raw subject-dependent setup.

Results. The results of the random-label subject-dependent setup are presented in Table 5. For comparison, we also include the results from the original subject-dependent and subject-discrimination setups. The findings are both intriguing and surprising. The best results among the four methods in the random-label subject-dependent setup are 97.12%, 89.71%, 99.83%, and 72.54% for the ADFTD, TDBrain, PTB, and PTB-XL datasets, respectively, which are unexpectedly high.

Considering that there are no disease-related features available under this setup, the model’s performance should, in theory, be completely random if it relies solely on disease-related features $\bm{x}^{d}$ to classify the label $\bm{y}$. However, taking the Medformer results as an example, the performance drop from the subject-dependent to the random-label subject-dependent setup is almost negligible for both ADFTD and PTB. This indicates that the model learns almost nothing about disease-related features $\bm{x}^{d}$ during training in the subject-dependent setup and instead relies entirely on subject-specific features $\bm{x}^{s}$ as a shortcut for label $\bm{y}$ classification. These findings are consistent with the results from the subject-discrimination setup, where ADFTD and PTB also achieved high classification performance, demonstrating their strong subject-specific features. For the TDBrain and PTB-XL datasets, which show relatively weaker subject-specific features in the subject-discrimination setup, the performance drop from subject-dependent to random-label subject-dependent using Medformer is approximately 10% and 17% F1 score, respectively. This indicates that the model does, in fact, learn some disease-related features $\bm{x}^{d}$ in the subject-dependent setup for these two datasets.

In summary, these results suggest that, depending on the dataset, it is possible for the model $f_{\theta}$ to achieve a very high F1 score (over 95%) under the subject-dependent setup while learning little to nothing about the meaningful disease-related features $\bm{x}^{d}$ in the dataset. One might assume that increasing the number of subjects could help the model focus more on general disease-related features $\bm{x}^{d}$ rather than relying on subject-specific features $\bm{x}^{s}$ as shortcuts. However, even with the large PTB-XL dataset containing 17,596 subjects, subject-specific features still had a significant impact on performance. For instance, Medformer’s performance in the random-label subject-dependent setup reached an F1 score of 71.15%, which easily surpassed the 59.97% F1 score achieved in the subject-independent setup. Therefore, we strongly recommend that researchers avoid using the subject-dependent setup for disease diagnosis tasks when working with Type-III MedTS datasets. Instead, adopting the subject-independent setup provides a more realistic evaluation that aligns with real-world applications.

#### 4.2.3 Results of Random-Label Subject-Independent

For completeness, we perform the random-label subject-independent setup to confirm that features $\bm{x}^{o}$, other than disease-related $\bm{x}^{d}$ and subject-specific $\bm{x}^{s}$ features, do not significantly affect the model’s performance. Appendix E.1 presents the detailed setup description and results.

### 4.3 Results of Different Setups on Type-II MedTS

**Table 6: This table presents the results of Type-II MedTS datasets evaluated under the mixed-subject-dependent (M-Sub-Dep), causal-subject-dependent (C-Sub-Dep), and subject-independent (Sub-Indep) setups. The dramatic performance drop observed for the WG-fNIRS dataset when shifting from the mixed to the causal subject-dependent setup highlights how inflated performance can be mitigated using the causal-subject-dependent setup, especially when overlapping samples are used in data preprocessing. Besides, the performance gap between the causal-subject-dependent and subject-independent setups is relatively small, suggesting that the causal-subject-dependent provides a reliable alternative for classifying Type-II MedTS if the subject-independent setup is not feasible.**
| Models | MLP | TCN | Transformer | Medformer |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Datasets | Setups | Accuracy | F1 Score | Accuracy | F1 Score | Accuracy | F1 Score | Accuracy | F1 Score |
| EEGMMIDB<br>(3-Classes) | M-Sub-Dep | 64.12 $\pm$0.93 | 60.74 $\pm$0.96 | 68.18 $\pm$0.65 | 64.04 $\pm$0.71 | 71.14 $\pm$0.55 | 68.64 $\pm$0.47 | 69.82 $\pm$0.59 | 67.08 $\pm$0.52 |
| C-Sub-Dep | 62.97 $\pm$0.11 | 58.63 $\pm$0.30 | 66.06 $\pm$0.37 | 59.70 $\pm$1.00 | 68.98 $\pm$0.67 | 65.56$\pm$0.63 | 69.43 $\pm$0.72 | 65.50 $\pm$0.73 |  |
| Sub-Indep | 61.58$\pm$1.01 | 57.98 $\pm$0.98 | 62.80 $\pm$0.67 | 57.58 $\pm$0.87 | 67.32 $\pm$0.65 | 64.03 $\pm$0.53 | 67.59 $\pm$0.44 | 64.23 $\pm$0.19 |  |
| WG-fNIRS<br>(2-Classes) | M-Sub-Dep | 61.35 $\pm$0.45 | 61.32 $\pm$0.47 | 79.75 $\pm$0.66 | 79.74 $\pm$0.66 | 83.74 $\pm$0.77 | 83.73 $\pm$0.77 | 72.79 $\pm$1.45 | 72.77 $\pm$1.44 |
| C-Sub-Dep | 57.16 $\pm$1.60 | 57.10 $\pm$1.59 | 59.64 $\pm$1.07 | 59.40 $\pm$0.97 | 59.06 $\pm$0.79 | 59.01 $\pm$0.80 | 59.00 $\pm$1.50 | 58.89 $\pm$1.52 |  |
| Sub-Indep | 54.21 $\pm$0.71 | 54.17 $\pm$0.75 | 55.00 $\pm$1.52 | 54.92 $\pm$1.57 | 55.28 $\pm$0.44 | 55.00 $\pm$0.52 | 54.88 $\pm$0.65 | 54.82 $\pm$0.66 |  |

Setup. The causal-subject-dependent setup involves splitting each subject’s samples in a time-stratified manner, where the data is divided into time-based segments for training, validation, and test sets. This setup evaluates the model’s ability to handle temporal shifts within the data. More critically, many MedTS datasets, due to their limited size, use overlapping samples to increase the number of available samples. In the mixed-subject-dependent setup, these overlapping samples can be split between training and test sets, leading to significant data leakage and artificially inflated performance. The causal-segment setup mitigates this issue by ensuring that time-adjacent samples remain together, except at the boundary where the data is split, thereby preventing most overlap between training and test sets. This approach reduces the risk of data leakage and ensures that the model’s performance reflects its ability to generalize across temporally shifted data, rather than being inflated by overlapping samples.

Results. The results of the causal-subject-dependent setup are presented in Table 6. After preprocessing, the EEGMMIDB dataset contains no overlapping samples, while the WG-fNIRS dataset has 80% overlapping samples. For the Transformer model on EEGMMIDB, the performance gap in F1 score between the mixed-subject-dependent and causal-segment subject-dependent setups is relatively small, around 3%. However, for WG-fNIRS, the performance gap is substantial, approximately 25%. This significant discrepancy underscores the risk of data leakage in datasets with overlapping samples, validating our concern. Therefore, when a subject-independent setup is not feasible, we recommend practitioners adopt the causal-subject-dependent setup, especially for datasets with overlapping samples, to avoid artificially inflated performance results.

## 5 Discussion and Conclusion

Limitations and Future Works.
While this paper conducts thorough experiments and provides valuable insights into evaluating models on Type-III (multi-subject, single-class) MedTS datasets, we are aware of several limitations. (1) Our experiments were primarily focused on Type-III datasets, and we only conducted preliminary experiments on Type-II (multi-subject, multi-class) datasets, and discussed Type-I (single-subject, multi-class) datasets in Appendix C. Given the distinct nature of these dataset types, future work should explore the behavior of models on Type-I and Type-II MedTS datasets to assess whether the same trends observed here, particularly the reliance on subject-specific information, hold across more personalized or multi-class scenarios. (2) While we have shown that subject-dependent setups can yield misleadingly high performance and advised researchers to avoid them, developing a robust model for subject-independent setups remains a significant challenge. Ensuring models can generalize effectively across different subjects without relying on subject-specific information is a complex task that requires further research and innovation.

Conclusion.
We introduce a new taxonomy for MedTS based on datasets and subject dependency. Additionally, we propose a decomposition paradigm for MedTS data, consisting of disease-related features $\bm{x}^{d}$, subject-specific features $\bm{x}^{s}$, and extraneous features $\bm{x}^{o}$.
To investigate the influence of subject-specific features, we design three new experimental setups, namely subject-discrimination, random-label subject-dependent, and random-label subject-independent, to demonstrate their existence and quantify their impact on model performance.
Our experiments reveal that it is possible for a model to learn little to nothing about disease-related features $\bm{x}^{d}$ while achieving deceptively high performance under the subject-dependent setup. These findings suggest that the subject-independent setup is a more practical setup for MedTS evaluation.

## Appendix A Data Preprocessing

### A.1 TDBrain Preprocessing

The TDBrain dataset(^1^11[https://brainclinics.com/resources/](https://brainclinics.com/resources/)), referenced in the paper van Dijk et al. (), is a large permission-accessible EEG time series dataset recording brain activities of 1274 subjects with 33 channels. Each subject has two trials: one under eye open and one under eye closed setup. The dataset includes a total of 60 labels, with each subject potentially having multiple labels indicating multiple diseases simultaneously. In this paper, we utilize a subset of this dataset containing 25 subjects with Parkinson’s disease and 25 healthy controls, all under the eye-closed task condition. Each eye-closed trial is segmented into non-overlapping 1-second samples with 256 timestamps, and any samples shorter than 1-second are discarded. This process results in 6,240 samples. Each sample is assigned a subject ID to indicate its originating subject. For the training, validation, and test set splits, we employ the subject-independent setup. Samples with subject IDs {18,19,20,21,46,47,48,49} are assigned to the validation set, while samples with subject IDs {22,23,24,25,50,51,52,53} are assigned to the test set. The remaining samples are allocated to the training set.

### A.2 ADFTD Preprocessing

The Alzheimer’s Disease and Frontotemporal Dementia (ADFTD) dataset(^2^22[https://openneuro.org/datasets/ds004504/versions/1.0.6](https://openneuro.org/datasets/ds004504/versions/1.0.6)), referenced in the papers Miltiadous et al. (; ), is a public EEG time series dataset with 3 classes, including 36 Alzheimer’s disease (AD) patients, 23 Frontotemporal Dementia (FD) patients, and 29 healthy control (HC) subjects. The dataset has 19 channels, and the raw sampling rate is 500Hz. Each subject has a trial, with trial durations of approximately 13.5 minutes for AD subjects (min=5.1, max=21.3), 12 minutes for FTD subjects (min=7.9, max=16.9), and 13.8 minutes for HC subjects (min=12.5, max=16.5). A bandpass filter between 0.5-45Hz is applied to each trial. We downsample each trial to 256Hz and segment them into non-overlapping 1-second samples with 256 timestamps, discarding any samples shorter than 1 second. This process results in 69,752 samples. For the training, validation, and test set splits, we employ both the subject-dependent and subject-independent setups. For the subject-dependent setup, we allocate 60%, 20%, and 20% of total samples into the training, validation, and test sets, respectively. For the subject-independent setup, we allocate 60%, 20%, and 20% of total subjects with their corresponding samples into the training, validation, and test sets, respectively.

### A.3 PTB Preprocessing

The PTB dataset(^3^33[https://physionet.org/content/ptbdb/1.0.0/](https://physionet.org/content/ptbdb/1.0.0/)), referenced in the paper PhysioBank (), is a public ECG time series recording from 290 subjects, with 15 channels and a total of 8 labels representing 7 heart diseases and 1 health control. The raw sampling rate is 1000Hz. For this paper, we utilize a subset of 198 subjects, including patients with Myocardial infarction and healthy control subjects. We first downsample the sampling frequency to 250Hz and normalize the ECG signals using standard scalers. Subsequently, we process the data into single heartbeats through several steps. We identify the R-Peak intervals across all channels and remove any outliers. Each heartbeat is then sampled from its R-Peak position, and we ensure all samples have the same length by applying zero padding to shorter samples, with the maximum duration across all channels serving as the reference. This process results in 64,356 samples. For the training, validation, and test set splits, we employ the subject-independent setup. Specifically, we allocate 60%, 20%, and 20% of the total subjects, along with their corresponding samples, into the training, validation, and test sets, respectively.

### A.4 PTB-XL Preprocessing

The PTB-XL dataset(^4^44[https://physionet.org/content/ptb-xl/1.0.3/](https://physionet.org/content/ptb-xl/1.0.3/)), referenced in the paper Wagner et al. (), is a large public ECG time series dataset recorded from 18,869 subjects, with 12 channels and 5 labels representing 4 heart diseases and 1 healthy control category. Each subject may have one or more trials. To ensure consistency, we discard subjects with varying diagnosis results across different trials, resulting in 17,596 subjects remaining. The raw trials consist of 10-second time intervals, with sampling frequencies of 100Hz and 500Hz versions. For our paper, we utilize the 500Hz version, then we downsample to 250Hz and normalize using standard scalers. Subsequently, each trial is segmented into non-overlapping 1-second samples with 250 timestamps, discarding any samples shorter than 1 second. This process results in 191,400 samples. For the training, validation, and test set splits, we employ the subject-independent setup. Specifically, we allocate 60%, 20%, and 20% of the total subjects, along with their corresponding samples, into the training, validation, and test sets, respectively.

### A.5 WG-fNIRS Preprocessing

The Word Generation functional near-infrared spectroscopy (WG-fNIRS) dataset, referenced in the papers Shin et al. (; ); Blankertz et al. (), contains 26 subjects, each participating in 60 trials across three sessions. In each session, 20 trials were conducted in random order, balanced between two classes: 10 Word Generation (WG) and 10 Baseline (BL) trials. The fNIRS data were recorded from 72 channels at a sampling rate of 10 Hz. Each trial consists of a 2-second instruction period, a 10-second task period, and a 13–15-second resting period. Before further preprocessing, the data are downsampled to 5 Hz. We then segment each trial into 5-second samples with 80% overlap, resulting in 9,360 samples. Each sample is labeled with the subject ID to indicate its originating subject. For the training, validation, and test set splits, we employ mixed subject-dependent, causal subject-dependent, and subject-independent setups. In the mixed subject-dependent setup, 60%, 20%, and 20% of the total samples are randomly assigned to the training, validation, and test sets, respectively. In the causal subject-dependent setup, 60%, 20%, and 20% of each subject’s samples, sorted by time order, are allocated to the training, validation, and test sets. In the subject-independent setup, 16, 6, and 6 subjects are randomly assigned to the training, validation, and test sets, respectively.

### A.6 EEGMMIDB Preprocessing

The EEG Motor Movement/Imagery Database (EEGMMIDB), referenced in the paper Schalk et al. (); Goldberger et al. (), contains recordings from 109 subjects engaged in motor imagery tasks, where they were instructed to either perform or imagine specific movements. Each subject participated in 14 distinct tasks, encompassing both motor execution and motor imagery involving hand and foot movements. The EEG data were recorded from 64 channels at a sampling rate of 160 Hz. Each trial comprises a 2-second preparation phase, during which the subject receives instructions about the task, followed by a 4-second period where the movement is either executed or imagined.

During preprocessing, data from subjects 88, 92, and 100 were removed due to a different sampling rate. For our experiments, we selected task 3, task 7, and task 11, and segmented the 4-second task period, resulting in 9,236 samples. For the training, validation, and test set splits, we employ mixed subject-dependent, causal subject-dependent, and subject-independent setups. In the mixed subject-dependent setup, one-third of the total samples are randomly assigned to each of the training, validation, and test sets. In the causal subject-dependent setup, the samples from task 3, task 7, and task 11 of each subject are assigned to the training, validation, and test sets, respectively. For the subject-independent setup, 36, 36, and 35 subjects are randomly allocated to the training, validation, and test sets, respectively.

## Appendix B Implementation Details

We implement the baselines based on the Time-Series-Library project(^5^55[https://github.com/thuml/Time-Series-Library](https://github.com/thuml/Time-Series-Library)) from Tsinghua University Wu et al. (). The four baselines we employ are MLP Popescu et al. (), TCN Bai et al. (), Transformer Vaswani et al. (), and Medformer Wang et al. ().

For MLP, we employ 2 layers with hidden dimension 256. For Transformer and Medformer, we employ 6 layers for the encoder, with the self-attention dimension $D$ set to 128 and the hidden dimension of the feed-forward networks set to 256. The patch list for Medformer is set to {2,4,8} as default. For TCN, we employ 6 layers for the encoder, with hidden dimension 128 and kernel size 3.

## Appendix C Discussion on Type-I MedTS

In certain MedTS classification tasks, such as personalized health monitoring or brain-computer interface (BCI) systems, where the goal is to train a model that can efficiently control a device (e.g., a wheelchair) for a specific individual, the subject-dependent setup becomes reasonable. In these cases (Type-I MedTS datasets) the training, validation, and test sets are derived from the same subject. This setup aligns with the task’s objective of personalizing the model to perform optimally for a single subject, where cross-subject generalization is not the primary focus. We also emphasize the importance of maintaining temporal order in such classification tasks. The evaluation of such Type-I cases is an important future direction.

## Appendix D Limitations and Future Works

## Appendix E More Results

### E.1 More Results

**Table 7: The table presents the results of Type-III datasets evaluated under the random-label subject-independent setup (R-Sub-Indep), along with the results of the original subject-independent setup (Sub-Indep) for comparison. As expected, the performance dropped to random under the random-label subject-independent setup, showing that other features $\bm{x}_{o}$ do not impact the model’s performance.**
| Models | MLP | TCN | Transformer | Medformer |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| Datasets | Setups | Accuracy | F1 Score | Accuracy | F1 Score | Accuracy | F1 Score | Accuracy | F1 Score |
| ADFTD<br>(3-Classes) | Sub-Indep | 49.10$\pm$1.01 | 43.78$\pm$0.28 | 50.46$\pm$1.35 | 47.32$\pm$1.27 | 50.47$\pm$2.14 | 48.09$\pm$1.59 | 52.37$\pm$1.51 | 48.72$\pm$1.18 |
| R-Sub-Indep | 30.84$\pm$1.99 | 29.46$\pm$1.39 | 33.25$\pm$6.53 | 31.82$\pm$7.08 | 30.92$\pm$5.25 | 29.70$\pm$6.21 | 30.67$\pm$7.05 | 29.82$\pm$7.53 |  |
| TDBrain<br>(2-Classes) | Sub-Indep | 69.42$\pm$0.64 | 69.37$\pm$0.64 | 83.98$\pm$2.31 | 83.93$\pm$2.35 | 86.58$\pm$0.76 | 86.52$\pm$0.79 | 83.92$\pm$1.01 | 83.69$\pm$1.09 |
| R-Sub-Indep | 52.48$\pm$6.23 | 50.64$\pm$5.77 | 55.71$\pm$10.01 | 52.55$\pm$9.46 | 59.44$\pm$6.60 | 57.21$\pm$6.50 | 58.71$\pm$5.45 | 56.82$\pm$4.94 |  |
| PTB<br>(2-Classes) | Sub-Indep | 77.76$\pm$0.46 | 70.02$\pm$0.60 | 83.97$\pm$2.26 | 78.99$\pm$3.44 | 77.37$\pm$1.02 | 68.47$\pm$2.19 | 77.86$\pm$1.64 | 69.93$\pm$2.69 |
| R-Sub-Indep | 50.27$\pm$6.39 | 49.91$\pm$6.34 | 50.54$\pm$5.28 | 49.93$\pm$5.45 | 48.38$\pm$2.18 | 48.16$\pm$1.99 | 50.38$\pm$2.58 | 49.98$\pm$2.49 |  |
| PTB-XL<br>(5-Classes) | Sub-Indep | 66.16$\pm$0.16 | 51.13$\pm$0.20 | 73.30$\pm$1.00 | 62.10$\pm$0.29 | 71.13$\pm$0.33 | 59.58$\pm$0.55 | 71.37$\pm$0.44 | 59.97$\pm$0.41 |
| R-Sub-Indep | 20.00$\pm$0.19 | 19.94$\pm$0.16 | 19.76$\pm$0.49 | 19.65$\pm$0.55 | 20.18$\pm$0.45 | 19.89$\pm$0.39 | 19.89$\pm$0.21 | 19.79$\pm$0.18 |  |

Setup. Similar to the random-label subject-dependent setup, we apply the same process in the subject-independent setup, where we randomly assign a new label to each subject while retaining their subject IDs before splitting the data into training, validation, and test sets. The primary goal of this setup is to eliminate the potential influence of other features $\bm{x}^{o}$ on model performance. By masking the disease-related features $\bm{x}^{d}$ during training and ensuring that the model $f_{\theta}$ cannot use subject-specific features $\bm{x}^{s}$ as shortcuts under the subject-independent setup during validation and testing, we aim to determine whether any other features $\bm{x}^{o}$ besides disease-related and subject-specific features have any impact on model performance. In theory, if the results are completely random under this setup, it would indicate that no other features significantly affect the model’s performance.

Results. The results of the random-label subject-independent setup are presented in Table 7. As expected, the results for all four datasets are nearly random, corresponding to the number of classes in each dataset. For instance, while some methods, such as the Transformer on the TDBrain dataset, achieved a slightly higher F1 score of 57.21% (compared to the random 50% baseline), this is likely due to the relatively limited number of samples in TDBrain compared to the other three datasets. We consider this slight deviation acceptable. Overall, these results confirm that features other than disease-related and subject-specific features do not affect the model’s performance, reinforcing the conclusion that the subject-specific and disease-related features are the primary contributors to classification accuracy in MedTS datasets.

## Peer Reviews

confidence: 4
contribution: 1
initial_rating: 3
presentation: 2
questions: 1. “Researchers should use the subject-independent setup when evaluating MedTS datasets”. 

The word "should" may be too strong here. When developing an adaptive algorithm for a specific patient, the subject-dependent evaluation protocol may also be appropriate.

2. “However, many studies are still evaluating MedTS in subject-dependent setup, which is problematic.”

This assertion might not be entirely accurate for the medical field, as many studies already use subject-independent setups. Please refer to my references in the weaknesses section for examples.
soundness: 2
strengths: 1. Emphasizing the Importance of Evaluation Protocols

Developing a novel algorithm is certainly of interest to researchers in this field, but focusing on creating better and more useful evaluation protocols may be even more important for the algorithm’s effectiveness. This is especially crucial in the medical field. In this regard, this work could be beneficial to the research community. Additionally, I find it interesting that, after they completely removed disease-related features across subjects in MedFormer, the performance did not drop significantly. This suggests that the model may be learning spurious correlations in the dataset, which are not related to the true underlying values.

2. Experimental Design for Hypothesis Validation

Section 3.3 introduces three experiments—subject discrimination, random-label subject-dependent, and random-label subject-independent—to demonstrate that models can exploit spurious correlations to improve performance in subject-dependent settings. This approach is reasonable and likely to support the hypothesis.
summary: This paper addresses the challenges posed by subject-specific features in MedTS evaluation, highlighting how inappropriate evaluation setups can lead to misleadingly high performance. The authors categorize evaluation setups into two types: subject-dependent and subject-independent, demonstrating that subject-independent setups are generally more suitable for various MedTS tasks.

In the conclusion, the authors introduce a new taxonomy for MedTS data, breaking it down into disease-related features, subject-specific features, and extraneous features. They propose three experimental setups to examine the influence of subject-specific features on model performance. Their experiments show that models can achieve artificially high accuracy in subject-dependent setups without learning disease-related features, supporting the recommendation that subject-independent evaluation is a more reliable approach for MedTS tasks.
weaknesses: 1. Limited Novelty on the Audience in Medical Fields

The primary motivation behind this work is to encourage researchers to focus on selecting a more appropriate evaluation protocol, which I commend. However, the proposed "subject-independent evaluation protocol" is already a common practice in the evaluation of many machine learning algorithms within clinical journals. The examples listed below are not cherry-picked through extensive literature searches; with minimal effort, one can find numerous papers where evaluations are conducted in a subject-independent manner.
- Figure 1 in “Prospective, Multi-site Study of Patient Outcomes After Implementation of the TREWS Machine Learning-based Early Warning System for Sepsis,” R. Adams et al., Nature Medicine, 2022.
- Figure 1 in “Development and Validation of a Deep Learning Model to Reduce the Interference of Rectal Artifacts in MRI-based Prostate Cancer Diagnosis,” L. Hu et al., Radiology, 2024. 
You may want to refer to the cited papers above to check whether this subject-independent evaluation protocol is indeed widely accepted.

2. Absence of Type-II Experiments

In real-world scenarios, Type-II (multi-subject and multi-class) problems are very common. Therefore, to enhance the quality of this research project, it would be beneficial to include extensive experiments on Type-II datasets.

---

confidence: 4
contribution: 1
initial_rating: 3
presentation: 3
questions: -
soundness: 3
strengths: - The authors clearly explain the problem of not splitting the train/test dataset patient-wise.
- The manuscript is clear and understandable.
- The evaluation is robust and provides evidence for the hypotheses stated.
summary: The authors, through extensive experimentation, highlight the importance of excluding the same subjects from both the training and testing dataset splits when assessing various methods in Medical Time Series analysis. Medical data possess unique patterns specific to each subject, which the model learns. If the same subjects (albeit different instances) are used for evaluation, the resulting metrics are artificially inflated because the model has already encountered these patients during its training. Consequently, this performance level is not applicable to real-world situations.
weaknesses: In my opinion, the contribution of this study does not add knowledge to the community. Field studies in this community take this contribution for granted when evaluating their methods. Take the following as some examples.

[1], Attia ZI, Noseworthy PA, Lopez-Jimenez F, Asirvatham SJ, Deshmukh AJ, Gersh BJ, Carter RE, Yao X, Rabinstein AA, Erickson BJ, Kapa S, Friedman PA. An artificial intelligence-enabled ECG algorithm for the identification of patients with atrial fibrillation during sinus rhythm: a retrospective analysis of outcome prediction. Lancet. 2019 Sep 7;394(10201):861-867. doi: 10.1016/S0140-6736(19)31721-0. Epub 2019 Aug 1. PMID: 31378392.

[2] Raghu A., Chandak P., Ridwan A., Guttag J., Stultz CM. Sequential Multi-Dimensional Self-Supervised Learning for Clinical Time Series. International Conference on Machine Learning (ICML), PMLR 202:28531-28548, 2023

[3] Thapa, Rahul, et al. "SleepFM: Multi-modal Representation Learning for Sleep Across Brain Activity, ECG and Respiratory Signals." arXiv preprint arXiv:2405.17766 (2024).

In addition, it is a common practice when releasing a database (PTB-XL, CSPC2018 or Physionet Challenge 2017), to propose a split in order to avoid this issue.

---

confidence: 4
contribution: 2
initial_rating: 6
presentation: 3
questions: 1. Why did you choose accuracy over more suitable metrics like sensitivity, specificity, or AUROC for medical datasets?

2. How do you plan to ensure a fairer comparison between subject-dependent and subject-independent setups given the different splitting strategies?

3. Did you look into other works that have explored these two setups in the medical field?

4. How do you anticipate your findings will translate to Type-I and Type-II datasets, where tasks and dependencies are different?
soundness: 3
strengths: The paper effectively identifies the issue with subject-dependent setups, showing how they can mislead performance evaluation by exploiting subject-specific features.

The introduction of new experimental setups, subject-discrimination and random-label setups adds depth to the analysis and provides valuable tools for future research.

The experiments span multiple datasets (EEG, ECG, fNIRS) and models (MLP, TCN, Transformer, Medformer), supporting the generalizability of the findings across different modalities.

The work challenges common practices and provides practical advice for researchers working with medical datasets relevant to real world scenarios.
summary: This paper addresses the evaluation of models for medical time series (MedTS) classification by comparing subject-dependent and subject-independent setups where models can achieve deceptively high performance by relying on subject-specific features rather than disease-related patterns.
The authors demonstrate this issue using Type-III datasets (multi-subject, single-class) and propose new experimental setups to analyze feature reliance.
Through experiments on six datasets using different models, the authors show that subject-independent setups provide a more realistic measure of performance. The paper offers new experimental setups to analyze feature reliance and provides actionable recommendations for improving MedTS evaluation practices.
weaknesses: 1. The use of accuracy as a key metric is problematic, especially with some datasets being unbalanced. More appropriate metrics for medical applications, such as AUROC or sensitivity, would provide a better evaluation.

2. The comparison between subject-dependent and subject-independent setups is complicated by different data splitting strategies, making it harder to draw fair conclusions.

3. While the paper introduces novel setups, it overlooks several prior works in the medical field that already compare subject-dependent and subject-independent evaluations. Engaging with this literature would provide important context.

4. The experiments mainly focus on Type-III datasets, leaving questions about how these findings apply to Type-I and Type-II datasets.

More ideas on how to improve performance under subject-independent setups would increase the paper’s practical value.
Exploring the other dataset types (Type-I and Type-II) in future work would make the findings more widely applicable.
Addressing the issue of imbalanced datasets with better metrics would improve the rigor of the experiments.