Scalable Counterfactual Explanations for Time Series via Policy Learning
Organizations: McComish Department of Electrical Engineering and Computer Science, South Dakota State University, Brookings, SD, USA · Department of Computer Science, Utah State University, Logan, UT, USA
Abstract
Generating counterfactual (CF) explanations for time series is challenging due to complex temporal dependencies and the computational inefficiency of traditional instance-specific optimization. We propose a policy learning framework for counterfactual explanation in time series, trained as a one-step contextual-bandit policy-learning problem. By training an actor-critic agent in the latent space of a pre-trained autoencoder, our method learns a transferable policy that captures global structural regularities. Unlike existing methods that rely on iterative optimization for each new input, the learned policy enables direct generation of valid and plausible counterfactuals through a single forward pass, avoiding per-instance optimization at inference time. Experiments on 13 UCR benchmark datasets show that our framework achieves high validity and strong plausibility across multiple anomaly detection metrics. Overall, by decoupling counterfactual generation from per-instance optimization, the proposed method provides an efficient and scalable alternative to existing approaches for time series counterfactual explanations.
Figures & tables
| ID | Dataset Name | DS train size | DS test size | Type | |
|---|---|---|---|---|---|
| 0 | Chinatown | 24 | 20 | 343 | TRAFFIC |
| 1 | Coffee | 286 | 28 | 28 | SPECTRO |
| 2 | ECG200 | 96 | 100 | 100 | ECG |
| 3 | FordA | 500 | 3601 | 1320 | SENSOR |
| 4 | FordB | 500 | 3636 | 810 | SENSOR |
| 5 | FreezerRegularTrain | 301 | 150 | 2850 | DEVICE |
Counterfactual Explanations
Counterfactual explanations show how changing an input could alter a model’s prediction, supporting model understanding, auditing, and actionable recourse.
See all 123 papersConTex: Reformulating Counterfactual Generation For Time Series Forecasting
ConceptCF: Concept-based Counterfactuals for the Explainability of Time Series
Sit' instead of Walk' if you increase the scale of the movement''. In this paper, the concepts are constructed through time series decomposition, resulting in concepts such as scale, and frequency bands. Counterfactuals are generated using a genetic algorithm that optimizes the concept mutations. Evaluation against five state-of-the-art approaches demonstrates that ConceptCF consistently achieves top-tier performance across validity, confidence, proximity, sparsity and plausibility metrics.