Shapelet-based Model-agnostic Counterfactual Local Explanations for Time Series Classification
Qi Huang, Wei Chen, Thomas Bäck, Niki van Stein
TL;DR
This work tackles the challenge of explainability for time series classifiers by introducing Time-CF, a model-agnostic, instance-level counterfactual explanation framework that combines shapelet Transform with TimeGAN to generate plausible counterfactual sequences. By replacing contiguous subsequences identified via shapelets with TimeGAN-generated alternatives and selecting those that flip the classifier's prediction with minimal perturbation, Time-CF delivers faithful, interpretable explanations. Across four binary UCR datasets and multiple classifiers, Time-CF demonstrates strong performance in closeness ($L_1$-norm distance), sensibility (model-agnostic applicability), plausibility (low outlier rates), and sparsity (localized perturbations). The method offers practical impact for diagnosing decision boundaries in time series and sets a path for extending to multi-class and multivariate tasks, while highlighting areas for improving performance on imbalanced data.
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.
