Discovery of Important Subsequences in Electrocardiogram Beats Using the Nearest Neighbour Algorithm

Ricards Marcinkevics, Steven Kelk, Carlo Galuzzi, Berthold Stegemann

TL;DR

This paper introduces a novel method to identify "important" subsequences within time series data that, when removed, alter a classification outcome. This approach, applied to ECG data, not only enhances the interpretability of machine learning models but also aids in the detection of clinically relevant cardiac abnormalities.

What Problem Does This Paper Address?

Classifying time series data, such as electrocardiograms (ECGs), is a crucial task with applications ranging from medical diagnosis to speech recognition. While the k-Nearest Neighbors (k-NN) algorithm with Dynamic Time Warping (DTW) distance is a highly effective method for this, it often acts as a "black box." Practitioners and domain experts need to understand why a particular classification was made, not just the classification itself. This interpretability is becoming increasingly important, especially in regulated fields like healthcare. The paper addresses this gap by focusing on identifying the specific segments within a time series that are most influential in determining its classification.

Methods

The core of the paper's contribution lies in defining and finding "minimum modifying subsequences." These are the shortest contiguous segments within a time series whose removal causes the k-NN classifier (with DTW distance) to change its prediction. The authors propose an algorithm that iteratively searches for these subsequences. To make this computationally feasible, they introduce several optimizations:

  • Early abandoning and pruning: Techniques to stop DTW distance computations early if they are unlikely to yield a better result.
  • Re-using DTW alignments: Leveraging previously computed DTW alignment tables to speed up calculations for modified time series.
  • Lower bounding: Using approximations to quickly rule out potential nearest neighbors.
  • Relevance Measure: Beyond just finding the minimum subsequence, they introduce a measure to quantify the "relevance" of each individual time point. This is calculated by summing the inverse lengths of all minimum modifying subsequences that contain that specific point. This measure is visualized as a color-coded overlay on the time series, with yellow indicating high relevance.

Datasets

The authors evaluated their method on several ECG datasets:

  • ECG5000 dataset: Two largest classes were used from the UCR Time Series Classification Archive.
  • ARVD dataset: A small, stratified set of 16 beats from normal and abnormal subjects diagnosed with Arrhythmogenic Right Ventricular Dysplasia (ARVD), provided by Leeds General Infirmary.
  • PhysioBank databases: A set of beats from various ECGs.
  • CinC_ECG_torso: Used for QRS complex detection experiments.

The paper does not introduce new benchmark datasets but rather uses existing ones to demonstrate the utility of their interpretability method.

Key Insights and Ideas

  • Beyond Accuracy: The "Why" Matters: The paper strongly emphasizes that classification accuracy alone is insufficient; understanding the reasoning behind a classification is critical, especially in domains like healthcare.
  • Minimum Modifying Subsequences as Explanations: Identifying the smallest segment that changes a classification provides a focused and interpretable explanation for the model's decision.
  • Relevance as a Visual Tool: The proposed relevance measure, visualized as a heatmap, offers an intuitive way to highlight diagnostically important segments in time series data like ECGs.
  • Domain Expertise Alignment: The relevance values often align remarkably well with segments that medical experts (cardiologists) identify as significant, validating the method's clinical relevance.
  • "Backwards" Application for Feature Detection: The method can be used in reverse to detect known segments (like QRS complexes or T waves) by constructing specific classification tasks.

Key Results

  • Scalability: The implemented optimizations significantly improve the running time for computing relevance values, making the method practical for longer time series and larger datasets. For instance, with a dataset of 500 instances, the most efficient version processes an 80-point time series in the same time it takes the naive version to process a 40-point series.
  • ARVD Classification: For ARVD patients, high relevance values were concentrated around S waves, T waves, and P waves, aligning with known indicators of the disease. In healthy beats, relevance was consistently centered around T waves.
  • ECG5000 Classification: Relevance values successfully highlighted segments that visually distinguished between the two classes, specifically around time intervals [0,20] and [90,140], and particularly at peaks around time 100 and 135 in class 1 beats.
  • ECG Segment Detection: The method successfully identified QRS complexes and T waves by constructing specific classification tasks where the segment's removal altered the classification. Relevance values robustly indicated the locations of these segments.

Limitations and Future Work

  • Contiguous Subsequences Only: The current method focuses on contiguous subsequences. The authors acknowledge that non-contiguous subsequences are also important and suggest this as a direction for future research.
  • Computational Cost: While optimizations are made, the problem of finding minimum subsequences can still be computationally intensive, especially for very large datasets or complex time series.
  • Dataset Dependence: The effectiveness of the relevance measure can depend on the quality and representativeness of the training dataset. In some cases, for beats that did not exhibit clear abnormalities, the relevance measure was less informative.
  • Future Work: The authors suggest exploring non-contiguous subsequences, developing more advanced data structures for the NN algorithm, and applying the method to larger datasets and different types of physiological time series. They also propose further investigation into the mathematical properties of DTW distance under subsequence deletion.

Summary updated

Abstract

The classification of time series data is a well-studied problem with numerous practical applications, such as medical diagnosis and speech recognition. A popular and effective approach is to classify new time series in the same way as their nearest neighbours, whereby proximity is defined using Dynamic Time Warping (DTW) distance, a measure analogous to sequence alignment in bioinformatics. However, practitioners are not only interested in accurate classification, they are also interested in why a time series is classified a certain way. To this end, we introduce here the problem of finding a minimum length subsequence of a time series, the removal of which changes the outcome of the classification under the nearest neighbour algorithm with DTW distance. Informally, such a subsequence is expected to be relevant for the classification and can be helpful for practitioners in interpreting the outcome. We describe a simple but optimized implementation for detecting these subsequences and define an accompanying measure to quantify the relevance of every time point in the time series for the classification. In tests on electrocardiogram data we show that the algorithm allows discovery of important subsequences and can be helpful in detecting abnormalities in cardiac rhythms distinguishing sick from healthy patients.
BibTeX
@misc{marcinkevics2019discovery,
  author = {Ricards Marcinkevics and Steven Kelk and Carlo Galuzzi and Berthold Stegemann},
  title = {{Discovery of Important Subsequences in Electrocardiogram Beats Using the Nearest Neighbour Algorithm}},
  year = {2019},
  eprint = {1901.09187},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1901.09187},
}
Figure