Shapelet-based Model-agnostic Counterfactual Local Explanations for Time Series Classification

Qi Huang,Wei Chen,Thomas Bäck,Niki van Stein
2024-02-02
Abstract:In this work, we propose a model-agnostic instance-based post-hoc explainability method for time series classification. The proposed algorithm, namely Time-CF, leverages shapelets and TimeGAN to provide counterfactual explanations for arbitrary time series classifiers. We validate the proposed method on several real-world univariate time series classification tasks from the UCR Time Series Archive. The results indicate that the counterfactual instances generated by Time-CF when compared to state-of-the-art methods, demonstrate better performance in terms of four explainability metrics: closeness, sensibility, plausibility, and sparsity.
Machine Learning
What problem does this paper attempt to address?
This paper proposes a model-independent instance-based explanation method for time series classification called Time-CF. The algorithm utilizes shapelets and TimeGAN, a time series generative adversarial network, to provide counterfactual explanations for any time series classifier. The effectiveness of Time-CF is validated on multiple real-world time series classification tasks, and the results demonstrate its superiority over existing methods in terms of proximity, sensitivity, reasonableness, and sparsity, which are four interpretability metrics. The main objective of the paper is to address the interpretability issue in machine learning models, particularly in time series classifiers. With the widespread application of machine learning in critical domains, understanding and trust in the decision-making process of models become crucial. Therefore, post-hoc or ante-hoc explanations are needed to reveal the workings of the models. There is relatively little research on the interpretability of time series data, while counterfactual explanations have gained increasing attention at the instance level. The Time-CF algorithm first extracts shapelets from the time series and uses TimeGAN to generate counterfactual instances that are similar to the original instances but have different predicted outcomes. The prediction behavior is explained by comparing the differences between the original instances and the generated instances. The experiments show that Time-CF provides higher-quality explanations while minimizing the changes in the time series. The paper also compares Time-CF with other methods such as Native-Guide and Mlxextend, demonstrating its general applicability and ability to recognize temporal features of time series data across various classifiers. Furthermore, Time-CF shows excellent performance in terms of reasonableness and sparsity, especially in handling imbalanced datasets, although in some cases, its performance may be inferior to other methods. Future research directions include extending the method to multi-class and multi-variable time series classification tasks, as well as exploring the synergy between TimeGAN and shapelet transformations to improve performance on imbalanced datasets.