Explaining Time Series via Contrastive and Locally Sparse Perturbations
Zichuan Liu, Yingying Zhang, Tianchun Wang, Zefan Wang, Dongsheng Luo, Mengnan Du, Min Wu, Yi Wang, Chunlin Chen, Lunting Fan, Qingsong Wen
TL;DR
The paper tackles explaining multivariate time series by addressing distribution shift in perturbations with ContraLSP, a framework that learns counterfactual perturbations via contrastive learning and applies sample-specific sparse gates with an $\ell_0$-like penalty and a temporal trend-based smoothing. The method forms $\Phi(x, m) = m \odot x + (1- m) \odot x^r$ and optimizes a loss that preserves predictions while highlighting salient, temporally coherent features; counterfactuals are guided by a triplet-based objective and sample-wise masks are regularized through an erf-based $\ell_0$ proxy. Across synthetic white-box, black-box classification, and MIMIC-III clinical data, ContraLSP consistently outperforms baselines in information content and mask sharpness, with ablations confirming the value of the triplet loss and the trend-based smoothing. The approach advances explainability for time series by yielding faithful, sparse, and distribution-aligned perturbations, with practical impact for healthcare and finance settings where interpretation matters.
Abstract
Explaining multivariate time series is a compound challenge, as it requires identifying important locations in the time series and matching complex temporal patterns. Although previous saliency-based methods addressed the challenges, their perturbation may not alleviate the distribution shift issue, which is inevitable especially in heterogeneous samples. We present ContraLSP, a locally sparse model that introduces counterfactual samples to build uninformative perturbations but keeps distribution using contrastive learning. Furthermore, we incorporate sample-specific sparse gates to generate more binary-skewed and smooth masks, which easily integrate temporal trends and select the salient features parsimoniously. Empirical studies on both synthetic and real-world datasets show that ContraLSP outperforms state-of-the-art models, demonstrating a substantial improvement in explanation quality for time series data. The source code is available at \url{https://github.com/zichuan-liu/ContraLSP}.
