We present a new method for generating plausible counterfactual explanations for time series classification problems. The approach performs gradient-based optimization directly in the input space. To enforce plausibility, we integrate soft-DTW (dynamic time warping) alignment with $k$-nearest neighbors from the target class, which effectively encourages the generated counterfactuals to adopt a realistic temporal structure. The overall optimization objective is a multi-faceted loss function that balances key counterfactual properties. It incorporates losses for validity, sparsity, and proximity, alongside the novel soft-DTW-based plausibility component. We conduct an evaluation of our method against several strong reference approaches, measuring the key properties of the generated counterfactuals across multiple dimensions. The results demonstrate that our method achieves competitive performance in validity while significantly outperforming existing approaches in distributional alignment with the target class, indicating superior temporal realism. Furthermore, a qualitative analysis highlights the critical limitations of existing methods in preserving realistic temporal structure. This work shows that the proposed method consistently generates counterfactual explanations for time series classifiers that are not only valid but also highly plausible and consistent with temporal patterns.
翻译:本文提出了一种为时间序列分类问题生成合理反事实解释的新方法。该方法直接在输入空间中进行基于梯度的优化。为确保合理性,我们将软动态时间规整(soft-DTW)对齐与目标类的k近邻样本相结合,有效促使生成的反事实具备真实的时间结构。整体优化目标是一个多方面的损失函数,平衡了反事实的关键特性:包含有效性、稀疏性和邻近性损失,以及新颖的基于软动态时间规整的合理性组件。我们通过多个维度评估生成反事实的关键特性,将本方法与多种强基准方法进行比较。结果表明,本方法在有效性方面达到竞争性性能,同时在目标类分布对齐方面显著优于现有方法,体现了更优的时间真实性。此外,定性分析突显出现有方法在保持真实时间结构方面的关键局限。本研究表明,所提方法能为时间序列分类器持续生成不仅有效、而且高度合理且符合时间模式的反事实解释。