Decision-making with deep learning-based time series forecasting requires not only accurate predictions but also actionable insights. However, current architectures do not inherently provide such information. Specifically, guidance is needed on how current conditions must be modified to shift from a predicted outcome to a desired future scenario. Counterfactual explanations provide a natural framework for this task, as they represent minimal input changes that alter the model's prediction, indicating when and how intervention is required. Existing approaches rely on instance-wise optimization, leading to inconsistency across instances, high computational costs, and limited applicability in real-time settings. To address these limitations, we reformulate counterfactual generation for time series forecasting as the problem of learning a globally consistent intervention strategy, allowing counterfactuals to be generated through a single shared function. We propose Counterfactual Time Series Explanations (ConTex), a model-agnostic, decomposed architecture comprising a temporal context encoder and a conditional encoder, followed by two heads that capture interventions in terms of temporal relevance and modification strength. This structure overcomes the instability and inconsistency of instance-based approaches by producing targeted, interpretable interventions across time and feature dimensions in a single forward pass, making it suitable for real-time applications. Across multiple forecasting architectures and benchmark datasets, ConTex achieves state-of-the-art validity while generating sparse counterfactuals that minimize the number of necessary interventions. Additionally, our approach reduces computational cost by at least 12-36x compared to instance-wise generation and supports real-time inference at approximately 0.007 seconds.
翻译:摘要:基于深度学习的时间序列预测虽能提供准确预测结果,却难以直接生成辅助决策的可操作洞察,尤其缺乏指导如何调整当前条件以实现从预测结果向期望的未来情景转变的方案。反事实解释为这一任务提供了天然框架——通过揭示最小化输入修改带来的预测变化,指明干预的时机与方式。然而现有方法依赖逐实例优化,导致跨实例不一致性、高计算成本及实时场景适用性受限。为此,我们将时间序列预测中的反事实生成重构为学习全局一致干预策略的问题,通过单一共享函数实现反事实的生成。本文提出模型不可知的反事实时间序列解释方法(ConTex),其分解式架构包含时序上下文编码器与条件编码器,并通过两个输出头分别捕获时间相关性与修改强度的干预信息。该结构突破实例方法的稳定性与一致性缺陷,可在单次前向传播中生成跨时间与特征维度的精准可解释干预,适用于实时场景。在多种预测架构与基准数据集上,ConTex在生成最小干预次数的稀疏反事实时达到最先进的有效性。相较于逐实例生成方法,本方案将计算成本降低至少12-36倍,支持约0.007秒的实时推理。