ConTex: Reformulating Counterfactual Generation For Time Series Forecasting
Jan Voets
arXiv:2606.18049v1 [cs.LG] 16 Jun 2026
Hasan Tercan Tobias Meisen Sebastian Baum Institute for Technologies and Management of Digital Transformation University of Wuppertal [email protected]
Abstract 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, which calls for methodologies that can extract relevant insights and explain model behavior. Specifically, in the context of decision-making, 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, supporting decision-making by indicating when and how intervention is required. However, existing approaches rely on instance-wise optimization, leading to inconsistency across different instances, high computational costs, and thus 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 for any input sample 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 counterfactual generation by producing counterfactuals through targeted, interpretable interventions across time and feature dimensions in a single forward pass, making it suitable for real-time applications. We demonstrate this across multiple forecasting architectures and benchmark datasets, achieving state-of-the-art validity while generating sparse counterfactuals that minimize the number of necessary interventions. Additionally, our approach achieves an overall computational reduction of at least 12–36× compared to instance-wise generation and supports real-time inference at approximately 0.007 seconds inference time.
1
Introduction
Time series forecasting plays a critical role in a wide range of real-world applications, including energy systems, finance, weather prediction, healthcare, and supply chain management. While modern forecasting models achieve strong predictive performance, they remain largely opaque, limiting their usability in high-stakes decision-making scenarios Kim et al. [2025]. For example, in energy systems, operators may wish to understand how current demand or generation patterns must be adjusted to avoid future peak loads, which is crucial for maintaining grid stability and enabling peakshaving strategies Amara-Ouali et al. [2023], Dai et al. [2021]. Meanwhile, in healthcare, clinicians Preprint.
may seek to identify how a patient’s current state must change to prevent predicted deterioration from historic patient data Ko et al. [2023]. Explanation methods for time-series forecasting are typically retrospective: given an observed outcome, they aim to identify the factors that led to it, for instance, through feature attribution methods (e.g., TimeSHAP Bento et al. [2021], WindowSHAP Nayebi et al. [2023], TSHAP Nguyen and Ifrim [2026]), attention-based interpretations in transformer models (e.g., Temporal Fusion Transformers Lim et al. [2020], PatchTST Nie et al. [2023]), or a broad class of post-hoc explanation techniques Theissler et al. [2022], as well as interpretable representation-based approaches (e.g., EXCODER Hahn et al. [2026]). In contrast, decision-making requires a forward-looking perspective, whereby one must understand how to alter present conditions to achieve a desired future outcome. This reveals a fundamental gap: while forecasting models implicitly encode how present conditions shape future trajectories, they do not provide actionable guidance on how they could be understood and leveraged. For continuous time series data, the space of possible modifications is effectively unbounded and affects both the time and feature dimensions. For guidance to be actionable, any modifications should be minimal. In other words, only the necessary changes should be introduced to keep the time series as close as possible to its original form. The resulting alternative series of such minimum modification is referred to as a counterfactual Wachter et al. [2018]. Existing counterfactual generation methods for time series forecasting suffer from several limitations. Most approaches rely on instance-wise optimization, solving a separate problem for each sample Wang et al. [2023], Luo and Yin [2026], Wang et al. [2024], which leads to inconsistent, hard-tointerpret modifications and high computational costs, limiting applicability in real-time or interactive settings. More generally, generating counterfactuals for time series poses challenges in maintaining temporal coherence, plausibility, and sparsity of interventions Schlegel and Seidl [2026]. Additionally, existing methods often use target trajectories that depend on the input. For example, Wang et al. used input-dependent bounds or trend adjustments Wang et al. [2023], which improve feasibility by defining easy-to-satisfy targets but couple the objective to the original time series. This shifts part of the burden from modifying the input to adapting the objective itself, which obscures the true difficulty of achieving the desired outcome. Consequently, it fails to address the question of how the present must be altered to achieve a predefined future scenario. To overcome these limitations, we propose a different generation paradigm for counterfactual explanations in time series forecasting. Instead of solving a separate optimization problem for each instance, we learn a global intervention function that maps input states and target conditions to effective interventions. This amortized approach generates counterfactuals in a single forward pass and enables consistent intervention behavior across instances. Since interventions in time series are inherently structured along both temporal and feature dimensions, we therefore introduce ConTex, a neural architecture that decomposes them into temporal relevance and modification strength. This decomposition yields interpretable and structured counterfactuals by indicating where and how the input should be modified. In contrast to optimization-based approaches, ConTex learns generalizable intervention patterns and transforms any given time series into its counterfactual in a single forward pass at inference time. In summary, our contributions are as follows: • We shift counterfactual generation from instance-wise optimization to amortized intervention learning. This function maps input states and target conditions to effective interventions, enabling counterfactuals to be generated in a single forward pass. • We propose ConTex, an architecture that parameterizes interventions by two components: a temporal relevance mask that indicates where to modify and a modification strength that specifies how to modify. This leads to counterfactuals that are sparse, local, and interpretable. • We introduce target-conditioned attribution for time series forecasting, identifying which timesteps must be modified to achieve a desired outcome. This yields a forward-looking, intervention-based temporal relevance representation, highlighting actionable timesteps and providing an alternative to retrospective post-hoc attribution methods. We visualize this as a heatmap indicating the likelihood of achieving the desired result through modification. • By evaluating and comparing ConTex on four forecasting backbones (PatchTST, N-HiTS, DLinear, TiDE) and four benchmark datasets (NN5, Electricity, Tourism, M4), compared to per instance optimization, ConTex achieves the best validity in 16 of 16 cases and the best compactness in 14 of 16 cases, while reducing the generation cost by 12–36 times end-to-end. 2
2
Related Work
Counterfactual explanations were introduced by Wachter et al. [2018] as minimal input perturbations that change a model’s prediction. In time series, counterfactual generation spans optimization-based, instance-based, and generative latent-space approaches Schlegel and Seidl [2026]. Further, existing work has predominantly focused on classification settings rather than forecasting (e.g., Ateş et al. [2021], Delaney et al. [2021], Bahri et al. [2022], Yan and Wang [2023]). In the context of time series forecasting, particularly for actionable interpretability, most existing work focuses on scenario exploration rather than explicit counterfactual generation. Probabilistic models such as DeepAR Salinas et al. [2020] generate multiple plausible future trajectories, while architectures like the Temporal Fusion Transformer Lim et al. [2020] enable scenario analysis by conditioning on known future covariates. More closely related are approaches that incorporate causal reasoning into forecasting models Ferchichi et al. [2025], enabling “what-if” analyzes. However, these methods are embedded within the predictive model and do not aim to compute minimal input interventions for a fixed predictor. For counterfactual generation in time series forecasting, ForecastCF Wang et al. [2023] is among the first methods to explicitly address this problem by iteratively perturbing inputs to achieve desired trend changes. Subsequent works extend this optimization-based paradigm to domains such as cryptocurrency forecasting Luo and Yin [2026] and multivariate settings Wang et al. [2024]. A related line of work focuses on generating plausible future trajectories rather than minimal interventions. For example, Zuin and Veloso [2024] model future time series distributions via quantile regression and search for trajectories satisfying desired outcome constraints. While this improves statistical plausibility, the approach does not explicitly optimize minimal input changes for a fixed predictive model, distinguishing it from counterfactual formulations. In contrast to existing approaches, our method is neither integrated into the forecasting model nor based on instance-wise optimization. Instead, we replace instance-wise optimization by learning a global intervention function that predicts input modifications in a single forward pass, enabling efficient, real-time generation of counterfactuals across instances derived from a global policy. By decomposing interventions into temporal relevance and modification strength, our approach provides interpretable insights into both where and how the input must be changed. However, unlike plausibility-based approaches (e.g. Zuin and Veloso [2024]), ConTex does not explicitly enforce distributional constraints, instead relying on implicit regularization through temporal context modeling and minimal-intervention objectives.
3
Problem Formulation
We define a desired forecast as a trajectory within a set of bounds: Ytarget = y ∈ RH Lt ≤ yt ≤ Ut , Lt ≤ Ut ∀t ∈ {1, . . . , H} H
where L ∈ R
H
and U ∈ R
(1)
denote the lower and upper target bounds over horizon H.
Given an univariate time series x ∈ RTin , where Tin denotes the input sequence length, and a forecasting model fθ : RTin → RH with fixed parameters, the counterfactual problem consists of finding a minimally modified input x′ such that the resulting forecast satisfies the target constraint while preserving as much of x as possible: xcf = arg min R(x′ , x) ′ x
s.t.
fθ (x′ ) ∈ Ytarget .
(2)
PTin Here, preservation is measured by R(x′ , x) = ∥x′ − x∥2 + T1in t=1 1[|xt − x′t | > τ ] where the first term penalizes scale of deviations from the original input, while the second penalizes the number of altered timesteps. This formulation can be interpreted as a local constrained inverse problem: rather than inverting fθ globally, we seek an input x′ in the vicinity of x whose prediction fθ (x′ ) satisfies the desired Ytarget . We further simplify this problem by expressing the counterfactual as an additive modification of the original input, xcf = x + z, where z ∈ RTin denotes a minimal intervention. This allows us to reformulate the problem as z ∗ = arg min R(x + z, x) s.t. fθ (x + z) ∈ Ytarget . (3) z
3
Instead of directly optimizing over z, we seek an interpretable and sparse solution, and accordingly parameterize the intervention in a structured manner by decomposing it into temporal components. Specifically, we define a function that predicts (i) whether a modification is required and (ii) how strongly it should be applied: (m, s) = Gθ (x, ŷ, c), z = m ⊙ s,
(4) (5)
where Gθ predicts a temporal relevance mask m ∈ [0, 1]Tin and modification strength s ∈ RTin , conditioned on the input x, its current prediction ŷ = f (x), and conditioning vector c, a compact representation of Ytarget .
4
Method
4.1
ConTex Architecture Temporal Encoder
x ŷ, c
hx
Condition (γ, β) Encoder
FiLM Mod.
h̃x h̃x
Mask Head Strength Head
m z =m⊙s
xcf = x + z
s
Figure 1: ConTex architecture. A target-conditioned model using feature-wise linear modulation (FiLM, Perez et al. [2017]) to adapt temporal features. The modulated representation is used to predict a temporal mask m ∈ [0, 1]T and a signed modification strength s ∈ RT ×D . Their composition yields the intervention z = m ⊙ s, which is added to the input to obtain the counterfactual sequence. Addressing the formulated problem requires an architecture that can decide whether a given timestep should be modified based on multiple factors: (i) its temporal context, (ii) its position within the sequence, (iii) its feature value, and (iv) the desired target trajectory. These requirements introduce multiple interdependent sources of complexity. A naive approach would attempt to model all of these aspects within a single monolithic component. However, this quickly becomes problematic, as each of these subtasks is structurally distinct. We therefore follow a modular design principle, where each component is responsible for a single specified function. In particular, we separate (i) the extraction of temporal context hx from the input sequence and (ii) the encoding of the desired target condition. These representations are combined through feature-wise linear modulation h̃x = hx ⊙ (1 + γ) + β, enabling the model to adapt its behavior to different desired trajectories. Additionally, the condition embedding is tiled across time and concatenated to the temporal representation before the prediction heads. Since the input exhibits temporal dependencies, the temporal encoder must capture both local and long-range patterns, which can be achieved using either recurrent or convolutional architectures. We evaluate both a bidirectional LSTM (BiLSTM) Hochreiter and Schmidhuber [1997] and a temporal convolutional network (TCN) Bai et al. [2018], with the TCN yielding superior performance. This is consistent with our objective of producing sparse and interpretable modifications, as the TCN constructs representations based on fixed receptive fields, enabling more explicit identification of localized patterns compared to the aggregated representations obtained through sequential propagation in recurrent models. In contrast, the condition is not provided as a sequence but as a fixed-size vector. Accordingly, the condition encoder is implemented as a multilayer perceptron (MLP) that maps c, comprising the desired trajectory center, width, current forecast, and slope, into a latent embedding. For full implementation details, see Appendix A.1.1. 4.2
Training Objective
Counterfactual generation involves a trade-off between achieving the desired forecast behavior and minimizing the magnitude and extent of the intervention. We therefore optimize a composite objective consisting of four components. Forecast alignment. To reach high validity, we need to (i) ensure that a high percentage of timesteps satisfy the bounds and (ii) that the forecast follows accurately the desired trend. Accordingly we 4
penalize deviations from the midpoint of the target bounds as well as the of (smooth)ŷtfraction −µt Ut −Lt t timesteps violating the constraints. Let µt = Ut +L , w = max , ε , δ = . t t 2 2 wt H
Lcenter =
H
1 X |δt |, H t=1
Lvalid =
1 X σ(κ(|δt | − 1)) . H t=1
(6)
Here, δt,d converts each constraint into a common coordinate system in which the boundary is at ±1, to enable Lcenter to measure distance to the desired trajectory and Lvalid to quantify violation frequency consistently across all timesteps. The steepness of the sigmoid transition is controlled by κ > 0. Intervention regularization. To ensure minimal interventions, both the magnitude of changes and the number of modified timesteps must be controlled. Accordingly, we impose proximity and sparsity constraints addressing each objective: T
Lprox =
in 1 X xcf − xt , Tin t=1 t
Lsparse =
Tin ∥m∥1 1 X mt (1 − mt ). + ∥m∥2 Tin t=1
(7)
where Tin denotes the input sequence length. To avoid over-penalizing localized but necessary deviations, we use an L1 proximity loss instead of L2 , promoting sparse and interpretable interventions over weak distributional shifting. Furthermore, to avoid degenerate solutions with uniformly distributed masks, Lsparse combines two terms: the first promotes compact interventions by encouraging concentrated mask activations, while the second acts as a binarization regularizer, pushing the mask towards near-binary decisions. Total loss.
The final objective is then given by Ltotal = λcenter Lcenter + λvalid Lvalid + λprox Lprox + λsparse Lsparse , balancing target satisfaction and minimal intervention. As our objective is to obtain valid and sparse counterfactuals, we employ an early stopping criterion that prioritizes validity and compactness. Specifically, training is stopped if a combined metric of validity and sparsity does not improve.
5
Experiments
5.1
Experimental Setup Dataset
Resolution
Input Length
Horizon
Characteristics
Source
M4 NN5 Tourism Electricity
Daily Daily Monthly Hourly
42 168 72 288
14 56 24 96
Smooth, trend-dominated Noisy, long-horizon Strong seasonality High-frequency
Makridakis et al. [2020] Andrawis et al. [2011] Godahewa et al. [2020b] Godahewa et al. [2020a]
Table 1: Overview of datasets used in our experiments.
Datasets and forecasting models. In order to evaluate the robustness and general applicability of the proposed method, we consider several datasets that span a diverse range of time series characteristics, as described in Table 1. Similarly, we select forecasting models covering diverse architectural paradigms, including linear decomposition-based models (DLinear, Zeng et al. [2022]), hierarchical MLP-based architectures (N-HiTS, Challu et al. [2022]), encoder–decoder architectures (TiDE, Das et al. [2024]), and transformer-based models (PatchTST, Nie et al. [2023]). Training protocol. For every dataset, all forecasting models are independently optimized, frozen, and reused across all counterfactual methods to ensure consistency and fairness. The resulting forecasting performance is reported in the appendix, Table 12. Architectural hyperparameters of ConTex are tuned once on the NN5 dataset, a challenging setting with long horizons and complex dynamics, and kept fixed across all other datasets. Only sparsity and proximity weights, learning rate, and dropout are tuned per dataset via a lightweight search on the best-performing model. Full details are in A.1. 5
Baselines. We compare ConTex against three baselines covering different approaches to counterfactual generation. ForecastCF Wang et al. [2023] represents an instance-wise, perturbation-based generation. We further apply early stopping to ensure convergence. In addition, we include a heuristic baseline inspired by BaseShift Wang et al. [2023]. However, as our targets are defined by externally specified trajectories, we adapt BaseShift by applying an additive shift, aligning the input mean with the target level. Finally, we include an adapted version of BaseNN Wang et al. [2023], which retrieves counterfactuals by selecting the nearest neighbor that satisfies the target constraint or maximizes validity with respect to the target set, given an input x. Further details can be found in A.4. While not providing interventions, BaseNN approximates the highest validity attainable when relying solely on existing data. Target Calibration. Instance-specific or manually designed targets introduce bias and reduce comparability across datasets due to their lack of (i) consistent control over task difficulty, (ii) evaluation across the full dataset distribution, and (iii) assessment of behavioral consistency across datasets. In consequence, to ensure a fair and systematic evaluation, we adopt a controlled target family spanning the data distribution consistently across datasets. However, to avoid introducing artificial structure, we restrict this family to linear trajectories with tolerance, including constant and increasing trends, capturing fundamental interventions such as level shifts and trend adjustments while enabling domain-agnostic evaluation. Furthermore, the difficulty of generating a counterfactual for a target Ytarget depends on (i) the width of the interval for f (x + z) and (ii) its position in the forecast distribution, with low-density targets being harder to achieve. We therefore calibrate targets using percentile-based intervals of the model’s output distribution. As a reference, we set the interval such that a simple baseline attains ∼ 50% validity (e.g. see Appendix A.2.1), representing moderate difficulty, and vary percentiles to control difficulty. Increasing trends are sampled from upper percentiles (e.g., 90th ) of the slope distribution at fixed interval width, ensuring standardized and challenging targets across datasets. Evaluation Metrics. We evaluate counterfactual quality using validity and data-manifold closeness metrics following Wang et al. [2023]. Validity Ratio and Stepwise Validity AUC (S-AUC) measure target satisfaction and temporal consistency, while Proximity and Compactness quantify deviation from the original input. Full metric definitions are provided in Appendix A.3. 5.2
Counterfactual Benchmark
Model
CF Model
NN5 Ratio ↑
Electricity S-AUC ↑
Ratio ↑
S-AUC ↑
Tourism Ratio ↑
S-AUC ↑
M4 Ratio ↑
S-AUC ↑
ForecastCF ConTex PatchTST BaseShift BaseNN
0.324±0.160 0.079±0.056 0.705±0.210 0.384±0.261 0.482±0.225 0.365±0.215 0.707±0.114 0.689±0.114 0.683±0.041 0.406±0.095 0.964±0.003 0.911±0.007 0.812±0.017 0.676±0.025 0.997±0.001 0.997±0.001 0.602 0.178 0.842 0.713 0.676 0.548 0.996 0.996 0.918 0.770 0.809 0.530 0.863 0.754 1.000 1.000
N-HiTS
ForecastCF ConTex BaseShift BaseNN
0.519±0.117 0.199±0.089 0.758±0.167 0.488±0.276 0.476±0.227 0.362±0.213 0.847±0.067 0.825±0.082 0.971±0.026 0.921±0.062 0.941±0.005 0.851±0.008 0.764±0.048 0.656±0.065 0.997±0.000 0.996±0.001 0.648 0.208 0.858 0.720 0.681 0.536 0.996 0.995 0.914 0.689 0.859 0.603 0.851 0.737 1.000 1.000
DLinear
ForecastCF ConTex BaseShift BaseNN
0.398±0.140 0.118±0.048 0.620±0.270 0.295±0.245 0.381±0.212 0.266±0.180 0.836±0.082 0.791±0.095 0.990±0.003 0.949±0.003 0.941±0.002 0.748±0.022 0.841±0.019 0.722±0.031 0.997±0.000 0.997±0.000 0.623 0.181 0.814 0.619 0.579 0.427 0.995 0.995 0.894 0.579 0.805 0.511 0.839 0.705 1.000 1.000
TiDE
ForecastCF ConTex BaseShift BaseNN
0.621±0.095 0.206±0.097 0.705±0.230 0.357±0.258 0.493±0.242 0.375±0.239 0.827±0.074 0.805±0.072 0.976±0.006 0.884±0.034 0.940±0.002 0.755±0.013 0.773±0.018 0.679±0.018 0.970±0.038 0.968±0.043 0.654 0.201 0.838 0.699 0.675 0.548 0.995 0.995 0.860 0.447 0.807 0.541 0.840 0.726 1.000 1.000
Table 2: Results for counterfactual generation (mean over 5 seeds). The best value for each dataset is marked in bold. ConTex outperforms the instance-based method ForecastCF in 16/16 cases and surpasses the retrieval-based reference BaseNN in 8/16 cases, demonstrating its ability to generate valid counterfactuals beyond existing dataset samples. Due to target calibration (see Table A.2.2), some trajectories already satisfy the constraints, allowing retrieval-based methods to achieve high validity. Accordingly, BaseNN performs equally (difference <1%) in 3/16 cases and achieves the highest validity in 5/16 cases. Table 2 reports the validity metrics of the generated counterfactuals. ConTex achieves high validity and S-AUC scores when producing counterfactuals across all datasets. 6
Model
CF Model
NN5 Comp. ↑
Electricity Prox. ↓
Comp. ↑
Prox. ↓
ForecastCF ConTex PatchTST BaseShift BaseNN
0.455±0.186 0.314±0.111 0.031 0.034
2.613±1.853 0.278±0.226 13.129±0.552 0.450±0.024 13.591 0.024 17.099 0.078
N-HiTS
ForecastCF ConTex BaseShift BaseNN
0.366±0.130 0.447±0.077 0.031 0.041
4.130±2.509 15.977±0.300 12.961 14.606
DLinear
ForecastCF ConTex BaseShift BaseNN
0.460±0.132 5.195±3.870 0.582±0.016 19.164±0.509 0.031 12.967 0.030 17.424
TiDE
ForecastCF ConTex BaseShift BaseNN
0.268±0.111 0.249±0.040 0.031 0.046
Tourism Comp. ↑
8.988±5.161 0.295±0.198 21.510±0.690 0.582±0.059 41.263 0.016 50.833 0.117
M4 Prox. ↓
Comp. ↑
Prox. ↓
8.012±3.372 0.862±0.051 0.299±0.139 12.233±0.488 0.974±0.001 1.239±0.006 35.101 0.034 4.811 28.390 0.789 0.507
0.275±0.234 14.195±8.889 0.309±0.204 7.540±2.455 0.765±0.005 20.315±0.390 0.517±0.055 11.067±0.640 0.018 55.874 0.017 34.987 0.086 53.817 0.128 28.669
0.687±0.109 0.367±0.133 0.977±0.000 0.747±0.016 0.033 4.760 0.595 0.831
0.263±0.222 13.010±8.741 0.425±0.181 10.580±5.471 0.765±0.083 0.612±0.275 0.607±0.008 18.754±0.243 0.704±0.014 12.285±0.299 0.977±0.000 0.751±0.013 0.018 54.826 0.017 34.977 0.034 4.757 0.075 52.012 0.109 28.325 0.586 0.836
3.481±1.707 0.258±0.227 12.427±8.370 0.283±0.199 10.179±0.148 0.690±0.003 18.072±0.092 0.411±0.026 13.187 0.019 57.002 0.016 13.200 0.080 52.895 0.118
6.230±1.792 8.342±0.726 35.142 27.989
0.730±0.112 0.324±0.143 0.948±0.020 1.719±0.991 0.033 4.782 0.570 0.823
Table 3: Results for counterfactual generation (mean over 5 seeds). Best reached value for every dataset is marked in bold. ConTex achieves the best compactness in 14 out of 16 cases.
We evaluate whether a method outperforms all baselines in both Validity Ratio and S-AUC across each of the 16 dataset–backbone combinations. Remarkably, instance-based generation (ForecastCF) is consistently outperformed by ConTex, and often even by the simple BaseShift heuristic, across all datasets and backbones. Notably, ConTex is the only method that frequently surpasses the retrievalbased reference BaseNN and achieves the strongest performance on average across datasets and forecasting backbones. Averaged over all dataset–backbone combinations, ConTex improves the mean Validity Ratio from 0.891 to 0.910 compared to BaseNN, corresponding to a relative improvement of approximately 2.1 %. Furthermore, ConTex increases the mean S-AUC from 0.677 to 0.830, yielding an average improvement of approximately 22.6 %. This indicates that it learns a global intervention policy that generalizes beyond dataset coverage, revealing how to reach trajectories even when they are not present in the historical data. ConTex
ForecastCF
Figure 2: Qualitative comparison of generated counterfactuals on M4 and NN5 using N-HiTS. Across both low- and high-noise datasets, the instance-based method ForecastCF produces numerous distributed changes. In contrast, ConTex applies interventions only when necessary: on smooth data, it focuses on recent timesteps, while on noisier data it introduces more distributed adjustments to achieve the desired trajectory. ConTex further shows higher precision in aligning forecasts with the target trend. Beyond validity, we further analyze the sparsity of the generated interventions in Table 3. ConTex achieves higher compactness consistently, requiring fewer modified timesteps. It exhibits predominantly lower proximity than BaseShift and BaseNN, though not quite as low as instance-based 7
generation. However, this trade-off should be interpreted in context, as proximity is only meaningful among valid counterfactuals. Methods that produce small but ineffective perturbations can lead to misleadingly strong results in terms of proximity and compactness. Furthermore, for ConTex, the trade-off between proximity and validity is a controllable design choice. By increasing the weight of the proximity term and relaxing sparsity constraints, ConTex can generate counterfactuals with substantially smaller deviations at the cost of reduced validity or compactness. This occurs because stronger proximity regularization constrains deviations from the original trajectory, limiting the interventions needed for validity (e.g., see A.7). Another important aspect is the behavior of the methods across datasets with varying characteristics. ConTex adapts to the underlying data properties, as illustrated in Figure 2. This is further reflected in the interventional relevance mask, which represents the importance of each timestep as a probability between 0 and 1 to reach the desired target. For the horizontal target trends considered above, we visualize the resulting masks in Figure 3.
Figure 3: Interventional (target-conditioned) attribution: Temporal relevance masks for a smooth M4 sample (left) compared to a more dispersed intervention pattern on NN5 (right). While for both datasets the intervention probability increases for more recent inputs, ConTex is able to learn that smooth data requires only minimal changes while noisy data requires substantially broader temporal structures, resulting in more distributed interventions across the input sequence. Despite methodological differences, both ConTex and ForecastCF exhibit similar scaling behavior with increasing target difficulty (Figure 4). Harder targets generally require larger and less compact interventions, reflected by decreasing compactness and increasing proximity. However, while ConTex maintains stable validity across difficulty regimes, ForecastCF shows a substantial degradation in validity, particularly for horizontal targets. S-AUC ↑
Compactness ↑
Proximity ↓
ForecastCF
ConTex
Ratio ↑
Figure 4: Metric behavior across increasing target difficulty on NN5 with N-HiTS. Generalization to Realistic Target Patterns Beyond standardized target families, we additionally evaluate ConTex on realistic target patterns sampled from the data distribution. Two examples are given in Figure 5. Both represent challenging distributional shifts involving substantial differences in temporal structure, amplitude, and overall signal dynamics. Despite these shifts, ConTex remains capable of generating highly accurate and valid counterfactual trajectories. Runtime Study. All experiments were conducted on an NVIDIA Tesla V100 GPU (32 GB VRAM) with CUDA 12.4 (driver 550.163.01). We report a representative study on NN5 using N-HiTS in the Appendix A.5. ConTex achieves a near-constant inference time of ∼0.007 s per sample. Even in the most challenging setting (95th percentile), this corresponds to a speedup of 3.7–4.2 orders of 8
Figure 5: Qualitative examples on realistic target trajectories. ConTex remains capable of reproducing complex target patterns beyond standardized trend-shift benchmarks. magnitude compared to instance-based generation (108 s per sample), whose runtime increases with target difficulty. In the least challenging setting, ConTex remains several orders faster (e.g., 32.5 s vs. 0.007 s), demonstrating consistent gains across all difficulty levels. Accounting for training (Table 11), ConTex incurs a one-time cost of 5–70 minutes depending on the dataset and the configuration (10–20 minutes on M4, up to 60–70 minutes on NN5). In contrast, ForecastCF requires ∼18 hours for all NN5 settings across 5 seeds (3.75 days total vs. 5.8 hours), resulting in an overall reduction in computational cost of at least 12×–36×. 5.3
Ablation Study Variant
Ratio ↑
S-AUC ↑
Comp. ↑
Prox. ↓
ConTex Full 0.971 ± 0.026 0.921 ± 0.062 0.447 ± 0.077 15.977 ± 0.300 w/o LL1 (MSE) 0.930 ± 0.036 0.900 ± 0.049 0.100 ± 0.123 12.953 ± 1.268 w/o Cond. Encoder 0.346 ± 0.003 0.136 ± 0.008 0.679 ± 0.045 7.691 ± 0.606 w/o Decomposition 0.998 ± 0.001 0.990 ± 0.002 0.340 ± 0.043 15.497 ± 0.273 w/o ŷ Condition 0.999 ± 0.001 0.995 ± 0.002 0.201 ± 0.061 15.175 ± 0.153 Table 4: Ablation study on NN5 with N-HiTS. Values are reported as mean ± standard deviation across seeds. We evaluated each architectural design choice through four ablation studies, each averaged over five random seeds. Since the architecture was optimized on NN5 using N-HiTS, we use this configuration as a representative example. The corresponding ablation results on Tourism (Table 14) confirm the same trends. First, we prove our decision to use MAE for optimizing compactness by replacing it with MSE for Lprox. Due to stronger penalties on large deviations, MSE discourages localized changes, reducing compactness (w/o LL1). Accordingly, we observe substantial drops in compactness, validity ratio, and S-AUC. As a second ablation, we remove the conditioning encoder. This substantially impairs the model’s ability to differentiate between desired target outcomes, leading to a substantial decrease in both validity ratio and S-AUC. At the same time, this result highlights that proximity and compactness must be interpreted with caution: although these metrics may appear to improve, such improvements are not meaningful if the method fails to achieve sufficiently high validity. As a third ablation, we remove the decomposition into mask and strength. While this encourages ConTex to explore modifications that lead to improvements in validity of around three percent more extensively, it drastically reduces compactness. Since sparse and interpretable modifications are of central relevance to counterfactuals, this trade-off is not preferable. As a final ablation, we remove ŷ from the condition input. Interestingly, this does not adversely affect validity, but results in a substantial reduction in compactness. This indicates that incorporating the current forecast is important for guiding the model toward sparser intervention strategies.
6
Conclusion
We demonstrate that, for time series forecasting, instance-wise optimization for counterfactual generation can be effectively replaced by amortized inference based on a global intervention policy. 9
Furthermore, a structurally decomposed intervention function, separating where to intervene from how, yields counterfactuals that are more valid, sparser, and orders of magnitude cheaper to generate, outperforming instance-based optimization and often even realistic data samples. Additionally, the decomposed architecture of ConTex provides insights into target-conditioned feature relevance and model behavior, offering a forward-looking, intervention-based perspective that is not captured by standard post-hoc attribution methods. While ConTex demonstrates strong performance, limitations remain. Firstly, ConTex does not explicitly enforce plausibility constraints, but instead implicitly promotes temporal coherence through regularization induced by the training data distribution, temporal encoding, and minimal-intervention objectives. Secondly, although the architecture generalizes across datasets and forecasting models, some hyperparameters, particularly those controlling proximity and sparsity, still require limited dataset-specific tuning, varying within relatively narrow ranges (0.05–0.4 for sparsity and 0.4–0.5 for proximity). Addressing these limitations, particularly through realistic constraints and more complex target formulations, represents an important direction for future work.
7
Acknowledgments
This work was supported by the European Union through the European Regional Development Fund (ERDF/EFRE) under grant number EFRE-20800908. The sole responsibility for the content of this publication lies with the authors.
10
A
Technical appendices and supplementary material
A.1
Architecture Setup
A.1.1
General Configuration Component Temporal Encoder Encoder Type Encoding Dimension Kernel Size TCN Dropout Receptive Field Ratio Dilations
Configuration TCN 64 3 0.1 1.0 Exponentially increasing, 2i
Condition Encoder Condition Input Conditioning MLP Condition Injection FiLM Scaling
Target parameters + forecast status 2 layers, hidden dim 8, embed dim 16 FiLM + temporal concatenation bounded, scale = 0.5
Prediction Heads Mask Head Strength Head Strength Scaling Intervention Output
Time-distributed MLP: 32–16–1, sigmoid Time-distributed MLP: 32–16–D, tanh Conditioned StrengthScaler, initial scale 1.0 z =m⊙s xcf = x + z
Training Batch Size Optimizer Seeds
128 Adam 0–4
Loss Weights λcenter λvalid
0.2 1.0
Sparsity Threshold τ 0.05 Annealing 0.1 → 1.0 (10 epochs) Table 5: Architectural configuration of ConTex. To ensure stable convergence, small deviations in the counterfactuals below a threshold of τ = 0.05 are ignored. Furthermore, we employ sparsity annealing, gradually increasing the sparsity regularization during training to encourage the exploration of diverse intervention patterns in early epochs while promoting more compact solutions later on.
11
A.1.2
Dataset Specific
Dataset
Learning Rate
TCN Dropout
Cond. Dropout
λsparse
λprox
Electricity 2e-4 0.10 0.00 0.05 0.50 NN5 1e-4 0.05 0.00 0.02 0.40 M4 1e-3 0.05 0.05 0.40 0.40 Tourism 1e-4 0.10 0.00 0.05 0.50 Table 6: Dataset-specific hyperparameters for ConTex. A small set of optimization parameters is tuned for each dataset, while all other architectural components remain fixed.
Dataset
Train
Validation
Test
NN5 M4 Tourism Electricity
85% of training series 85% of training series 85% of training series 85% of training series
10% of training series 10% of training series 10% of training series 10% of training series
Last 56 days of each series Last 14 days of each series Last 24 months of each series Last 4 months of each series
Table 7: Dataset-specific data splits. For all datasets, training and validation are constructed from the provided training portion of each dataset, while test samples correspond to the final forecasting horizon of each series.
12
A.2 A.2.1
Target Calibration Calibration Example Target
NN5
Electricity
Tourism
M4
0.5 horizontal 0.479 0.508 0.526 0.500 0.5 upward 0.268 0.220 0.145 0.489 0.6 horizontal 0.403 0.346 0.236 0.475 0.6 upward 0.212 0.152 0.092 0.475 0.7 horizontal 0.306 0.166 0.092 0.466 0.7 upward 0.159 0.089 0.054 0.464 0.8 horizontal 0.202 0.066 0.035 0.413 0.8 upward 0.107 0.046 0.027 0.408 0.9 horizontal 0.103 0.017 0.010 0.321 0.9 upward 0.049 0.014 0.009 0.315 0.95 horizontal 0.048 0.005 0.003 0.226 0.95 upward 0.020 0.005 0.002 0.220 Table 8: Example for calibration of target bounds across datasets on DLinear. The bounds width is adjusted so that forecasting purely based on existing dataset samples leads to approximately a 50 % validity ratio on horizontal bounds in the common data regime, ensuring feasibility on each dataset and ensuring that, at least in common regimes, samples already exist that satisfy the constraints to a certain degree.
A.2.2
Full Target Coverage Comparison Electricity Target
Ratio
Full
M4 Ratio
Full
0.5 horizontal 0.500 0.292 0.500 0.493 0.5 upward 0.150 0.000 0.492 0.475 0.6 horizontal 0.354 0.099 0.477 0.470 0.6 upward 0.110 0.000 0.477 0.469 0.7 horizontal 0.178 0.012 0.468 0.461 0.7 upward 0.071 0.000 0.466 0.458 0.8 horizontal 0.067 0.000 0.412 0.405 0.8 upward 0.039 0.000 0.409 0.400 0.9 horizontal 0.019 0.000 0.318 0.312 0.9 upward 0.013 0.000 0.314 0.307 0.95 horizontal 0.005 0.000 0.221 0.215 0.95 upward 0.005 0.000 0.217 0.209 Table 9: Comparison for full target coverage for M4 and Electricity. While both were calibrated to a 50 percent validity ratio, the dataset distribution significantly differs, leading to a high percentage of samples that satisfy the target constraints on M4 with 100 % validity, and therefore ensuring a high mean validity of BaseNN, while only a few satisfy the corresponding target constraints on Electricity.
13
A.3
Evaluation Metrics
We evaluate counterfactual quality using validity and data manifold closeness, adapted from prior work on time series counterfactuals Wang et al. [2023]. Validity. The Validity Ratio measures the fraction of forecasted timesteps satisfying the target constraints: ! K T 1 X 1X ′ ⊮ ŷk,t ∈ Ytarget,t , ValidityRatio = (8) K T t=1 k=1
where K is the number of counterfactuals and T the forecasting horizon. We further report Stepwise Validity AUC, capturing consecutive valid forecast steps. Data manifold closeness. To assess how much counterfactuals deviate from the original input, we use Proximity to measure the average Euclidean distance between the original input x and the counterfactual x′ , and Compactness to measure the proportion of timesteps that remain unchanged: ! K K T 1 X 1 X 1X ′ ′ Proximity = ∥xk − xk ∥, Compactness = ⊮ |xk,t − xk,t | ≤ τ . (9) K K T t=1 k=1
A.4
k=1
BaseNN
Algorithm 1 BaseNN (adapted): Retrieval of samples satisfying the target trajectory. Candidate samples are selected based on constraint satisfaction, and the nearest neighbor is returned as the counterfactual. Require: Training data xtrain , model fθ , bounds [L, U ], query x, minimum candidates M 1: Compute predictions ŷi = fθ (xi ) for all xi ∈ xtrain 2: Compute validity scores: H X vi = ⊮[ŷi,t ∈ [Lt , Ut ]] t=1
3: for τ ∈ {H, H − 1, . . . , 0} do 4: Cτ = {xi | vi ≥ τ } 5: if |Cτ | ≥ M then 6: break 7: end if 8: end for 9: return xcf = arg minxi ∈Cτ ∥x − xi ∥2
14
A.5
Runtime Results
A.5.1
NN5: Generation Time
Difficulty
Direction horizontal
0.50 upward horizontal 0.60 upward horizontal 0.70 upward horizontal 0.80 upward horizontal 0.90 upward horizontal 0.95 upward
Method
Mean
Min
Max
Total (s)
ConTex ForecastCF ConTex ForecastCF
0.007188 32.500600 0.007094 23.148600
0.006870 7.210600 0.006814 7.205000
0.007669 204.944300 0.008191 114.638600
0.6627 3055.0566 0.6646 2175.9652
ConTex ForecastCF ConTex ForecastCF
0.007076 15.892400 0.007057 26.798000
0.006819 2.542100 0.006855 7.067000
0.007998 209.665600 0.007852 80.611900
0.6633 1493.8873 0.6618 2519.0121
ConTex ForecastCF ConTex ForecastCF
0.007076 44.604500 0.007049 30.648600
0.006807 6.970400 0.006837 6.848100
0.007839 157.413000 0.007913 98.503000
0.6636 4192.8264 0.6609 2880.9678
ConTex ForecastCF ConTex ForecastCF
0.007040 60.288000 0.007074 50.014400
0.006831 6.903700 0.006832 7.096800
0.007805 186.274000 0.007850 121.303200
0.6603 5667.0713 0.6634 4701.3529
ConTex ForecastCF ConTex ForecastCF
0.007056 81.564700 0.007078 79.499700
0.006819 11.216600 0.006878 8.407300
0.007823 180.628700 0.007855 164.462500
0.6617 7667.0773 0.6638 7472.9678
ConTex ForecastCF ConTex ForecastCF
0.007065 108.473000 0.007065 104.345200
0.006856 6.987100 0.006857 7.064400
0.007832 266.547600 0.007905 223.090500
0.6626 10196.4579 0.6624 9808.4527
Table 10: Runtime statistics by difficulty percentile, direction, and method. For ConTex, inference time is measured as the forward-pass runtime, including synchronization via NumPy conversion to ensure that all GPU operations are completed.
A.5.2
ConTex Training Runtime Comparison Component
NN5 (s)
M4 (s)
Forecast Model Preparation Bounds Calibration
3.23 23.41
22.01 57.48
ConTex Training Validation
3074.57 1248.20
314.58 106.02
Test Evaluation Plot Generation
3.42 129.29
67.19 130.08
Total Pipeline 4542.80 758.34 Table 11: Runtime breakdown of the full ConTex pipeline with N-HiTS on NN5 in comparison to M4. While the total runtime includes all stages in the pipeline such as model preparation, bounds calibration, evaluation, and visualization, we focus on the core training time (highlighted in bold) for comparison, excluding validation time between epochs. While training time on ConTex in general is quite low, e.g. on M4 around 5-10 minutes, it increases with more complex and noisy data patterns such as on NN5 requiring approximately 58 minutes for the reported runtime study.
15
A.6
Forecasting Models Model
NN5
Electricity
Tourism
M4
PatchTST N-HiTS DLinear TiDE
22.363 22.015 22.428 24.195
11.966 12.595 15.192 13.831
19.213 19.464 18.775 19.773
3.022 3.010 2.994 3.121
Table 12: sMAPE (%) for each model and dataset. All forecasting models are trained once and not retrained across different seeds, ensuring that uncertainty estimates reflect only the variability of the counterfactual methods and are not confounded by forecasting model randomness. Consequently, results are reported for a single seed (seed 0) for the forecasting models, while the CF Models results are summarized across all tested seeds.
A.7
Trade-off Between Proximity and Validity
Sparsity 0.02 0.01 0.005 0.0005 0.0001 0.0001
Proximity 0.4 0.6 1.0 1.2 1.4 1.4
Type MAE MAE MAE MAE MAE MSE
Comp. ↑ 0.447 ± 0.077 0.553 ± 0.042 0.626 ± 0.014 0.708 ± 0.031 0.764 ± 0.017 0.067 ± 0.001
Prox. ↓ 15.977 ± 0.300 16.051 ± 0.172 14.765 ± 0.182 13.231 ± 0.574 11.812 ± 1.350 5.894 ± 0.039
S-AUC ↑ 0.921 ± 0.062 0.827 ± 0.084 0.683 ± 0.012 0.540 ± 0.046 0.439 ± 0.073 0.336 ± 0.005
Ratio ↑ 0.971 ± 0.026 0.938 ± 0.033 0.818 ± 0.010 0.738 ± 0.015 0.664 ± 0.032 0.603 ± 0.003
Table 13: Trade-off between sparsity, proximity, and validity in ConTex. While our primary objective prioritizes sparse and valid interventions, we observe that achieving higher validity typically comes at the cost of increased proximity error. This trade-off can be explicitly controlled through the choice of proximity loss and the relative weighting of sparsity and proximity terms. In particular, switching from MAE to MSE biases the model towards minimizing proximity, resulting in denser interventions and reduced validity. Overall, this demonstrates that ConTex does not enforce a fixed objective, but instead enables flexible adaptation to different optimization priorities.
A.8
Tourism Ablation
Variant
Ratio ↑
S-AUC ↑
Comp. ↑
Prox. ↓
ConTex Full 0.764 ± 0.048 0.656 ± 0.065 0.517 ± 0.055 11.067 ± 0.640 w/o LL1 (MSE) 0.632 ± 0.013 0.579 ± 0.018 0.280 ± 0.050 5.411 ± 0.121 w/o Cond. Encoder 0.138 ± 0.012 0.085 ± 0.004 0.930 ± 0.026 1.464 ± 0.599 w/o Decomposition 0.666 ± 0.029 0.608 ± 0.012 0.209 ± 0.167 6.240 ± 1.105 w/o Current Forecast 0.621 ± 0.059 0.558 ± 0.052 0.373 ± 0.125 5.926 ± 1.231 Table 14: Ablation study on the Tourism dataset using N-HiTS to validate the NN5 findings. Values are reported as mean ± standard deviation across random seeds. Similar to NN5, also on Tourism, the full ConTex configuration reaches the best trade-off between validity and compactness, and in contrast to NN5, the validity is not improved by any ablation.
16
References Yvenn Amara-Ouali, Matteo Fasiolo, Yannig Goude, and Hui Yan. Daily peak electrical load forecasting with a multi-resolution approach. International Journal of Forecasting, 39(3):1272– 1286, 2023. ISSN 0169-2070. doi: https://doi.org/10.1016/j.ijforecast.2022.06.001. URL https: //www.sciencedirect.com/science/article/pii/S0169207022000929. Robert R. Andrawis, Amir F. Atiya, and Hisham El-Shishiny. Forecast combinations of computational intelligence and linear models for the nn5 time series forecasting competition. International Journal of Forecasting, 27(3):672–688, 2011. ISSN 0169-2070. doi: https://doi.org/10.1016/ j.ijforecast.2010.09.005. URL https://www.sciencedirect.com/science/article/pii/ S0169207010001445. Special Section 1: Forecasting with Artificial Neural Networks and Computational Intelligence Special Section 2: Tourism Forecasting. Emre Ateş, Burak Aksar, Vitus Leung, and Ayse Coskun. Counterfactual explanations for multivariate time series. pages 1–8, 05 2021. doi: 10.1109/ICAPAI49758.2021.9462056. Omar Bahri, Soukaina Filali Boubrahimi, and Shah Muhammad Hamdi. Shapelet-based counterfactual explanations for multivariate time series, 2022. URL https://arxiv.org/abs/2208. 10462. Shaojie Bai, J. Zico Kolter, and Vladlen Koltun. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling, 2018. URL https://arxiv.org/abs/1803.01271. João Bento, Pedro Saleiro, André F. Cruz, Mário A.T. Figueiredo, and Pedro Bizarro. Timeshap: Explaining recurrent models through sequence perturbations. In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining, KDD ’21, page 2565–2573. ACM, August 2021. doi: 10.1145/3447548.3467166. URL http://dx.doi.org/10.1145/3447548. 3467166. Cristian Challu, Kin G. Olivares, Boris N. Oreshkin, Federico Garza, Max Mergenthaler-Canseco, and Artur Dubrawski. N-hits: Neural hierarchical interpolation for time series forecasting, 2022. URL https://arxiv.org/abs/2201.12886. Shuang Dai, Fanlin Meng, Hongsheng Dai, Qian Wang, and Xizhong Chen. Electrical peak demand forecasting- a review, 2021. URL https://arxiv.org/abs/2108.01393. Abhimanyu Das, Weihao Kong, Andrew Leach, Shaan Mathur, Rajat Sen, and Rose Yu. Long-term forecasting with tide: Time-series dense encoder, 2024. URL https://arxiv.org/abs/2304. 08424. Eoin Delaney, Derek Greene, and Mark T. Keane. Instance-based counterfactual explanations for time series classification, 2021. URL https://arxiv.org/abs/2009.13211. A. Ferchichi, A.B. Abbes, V. Barra, and I.R. Farah. Trustworthy AI for SpatioTemporal Forecasting via Counterfactual Causality. pages 10–17, 2025. doi: 10.1109/ICTAI66417.2025.00010. URL https://www.scopus.com/inward/record.uri? eid=2-s2.0-105031887993&doi=10.1109%2FICTAI66417.2025.00010&partnerID=40& md5=d6de56c36f3abd80813868f0f54b221b. Rakshitha Godahewa, Christoph Bergmeir, Geoff Webb, Rob Hyndman, and Pablo Montero-Manso. Electricity Hourly Dataset, June 2020a. URL https://zenodo.org/record/3889829. Rakshitha Godahewa, Christoph Bergmeir, Geoff Webb, Rob Hyndman, and Pablo Montero-Manso. Tourism Monthly Dataset, June 2020b. URL https://zenodo.org/record/3889425. Yannik Hahn, Antonin Königsfeld, Hasan Tercan, and Tobias Meisen. Excoder: Explainable classification of discrete time series representations, 2026. URL https://arxiv.org/abs/ 2602.13087. Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Comput., 9(8): 1735–1780, November 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.8.1735. URL https://doi.org/10.1162/neco.1997.9.8.1735. 17
Jongseon Kim, Hyungjoon Kim, HyunGi Kim, Dongjun Lee, and Sungroh Yoon. A comprehensive survey of deep learning for time series forecasting: architectural diversity and open challenges. Artificial Intelligence Review, 58(7):216, April 2025. ISSN 1573-7462. doi: 10.1007/ s10462-025-11223-9. URL https://link.springer.com/10.1007/s10462-025-11223-9. Ryoung-Eun Ko, Zero Kim, Bomi Jeon, Migyeong Ji, Chi Ryang Chung, Gee Young Suh, Myung Jin Chung, and Baek Hwan Cho. Deep Learning-Based Early Warning Score for Predicting Clinical Deterioration in General Ward Cancer Patients. Cancers, 15(21):5145, October 2023. ISSN 2072-6694. doi: 10.3390/cancers15215145. URL https://www.mdpi.com/2072-6694/15/ 21/5145. Bryan Lim, Sercan O. Arik, Nicolas Loeff, and Tomas Pfister. Temporal fusion transformers for interpretable multi-horizon time series forecasting, 2020. URL https://arxiv.org/abs/1912. 09363. X. Luo and W. Yin. Counterfactual Explanation-Based Cryptocurrency Price Prediction. Entropy, 28(1), 2026. doi: 10.3390/e28010065. URL https://www.scopus.com/inward/ record.uri?eid=2-s2.0-105028503537&doi=10.3390%2Fe28010065&partnerID=40& md5=76f11583c4b6477488a22a29f85fa8c4. Spyros Makridakis, Evangelos Spiliotis, and Vassilios Assimakopoulos. The m4 competition: 100,000 time series and 61 forecasting methods. International Journal of Forecasting, 36(1):54–74, 2020. ISSN 0169-2070. doi: https://doi.org/10.1016/j.ijforecast.2019.04.014. URL https://www. sciencedirect.com/science/article/pii/S0169207019301128. M4 Competition. Amin Nayebi, Sindhu Tipirneni, Chandan K Reddy, Brandon Foreman, and Vignesh Subbian. Windowshap: An efficient framework for explaining time-series classifiers based on shapley values, 2023. URL https://arxiv.org/abs/2211.06507. Thach Le Nguyen and Georgiana Ifrim. Tshap: Fast and exact shap for explaining time series classification and regression. In Rita P. Ribeiro, Bernhard Pfahringer, Nathalie Japkowicz, Pedro Larrañaga, Alípio M. Jorge, Carlos Soares, Pedro H. Abreu, and João Gama, editors, Machine Learning and Knowledge Discovery in Databases. Research Track, pages 60–77, Cham, 2026. Springer Nature Switzerland. ISBN 978-3-032-06078-5. Yuqi Nie, Nam H. Nguyen, Phanwadee Sinthong, and Jayant Kalagnanam. A time series is worth 64 words: Long-term forecasting with transformers, 2023. URL https://arxiv.org/abs/2211. 14730. Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron Courville. Film: Visual reasoning with a general conditioning layer, 2017. URL https://arxiv.org/abs/1709.07871. David Salinas, Valentin Flunkert, Jan Gasthaus, and Tim Januschowski. Deepar: Probabilistic forecasting with autoregressive recurrent networks. International Journal of Forecasting, 36(3): 1181–1191, 2020. ISSN 0169-2070. doi: https://doi.org/10.1016/j.ijforecast.2019.07.001. URL https://www.sciencedirect.com/science/article/pii/S0169207019301888. Udo Schlegel and Thomas Seidl. What-if explanations over time: Counterfactuals for time series classification, 2026. URL https://arxiv.org/abs/2603.27792. Andreas Theissler, Francesco Spinnato, Udo Schlegel, and Riccardo Guidotti. Explainable ai for time series classification: a review, taxonomy and research directions. Ieee Access, 10:100700–100724, 2022. Sandra Wachter, Brent Mittelstadt, and Chris Russell. Counterfactual explanations without opening the black box: Automated decisions and the gdpr, 2018. URL https://arxiv.org/abs/1711. 00399. Z. Wang, I. Miliou, I. Samsten, and P. Papapetrou. Counterfactual Explanations for Time Series Forecasting. pages 1391–1396, 2023. doi: 10.1109/ICDM58522.2023.00180. URL https: //www.scopus.com/inward/record.uri?eid=2-s2.0-85185401353&doi=10.1109% 2FICDM58522.2023.00180&partnerID=40&md5=206d3e362e2089be0f73b3aeca43966c. 18
Z. Wang, I. Samsten, I. Miliou, and P. Papapetrou. COMET: Constrained Counterfactual Explanations for Patient Glucose Multivariate Forecasting. pages 502–507, 2024. doi: 10.1109/CBMS61543.2024.00089. URL https://www.scopus.com/inward/record.uri? eid=2-s2.0-85200437241&doi=10.1109%2FCBMS61543.2024.00089&partnerID=40& md5=a224e4dfcecfaf00ad2130609bd91307. Jingquan Yan and Hao Wang. Self-interpretable time series prediction with counterfactual explanations, 2023. URL https://arxiv.org/abs/2306.06024. Ailing Zeng, Muxi Chen, Lei Zhang, and Qiang Xu. Are transformers effective for time series forecasting?, 2022. URL https://arxiv.org/abs/2205.13504. G. Zuin and A. Veloso. Navigating Time’s Possibilities: Plausible Counterfactual Explanations for Multivariate Time-Series Forecast through Genetic Algorithms. Number 2024, pages 2575–2582, 2024. doi: 10.1109/TrustCom63139.2024.00359. URL https://www.scopus. com/inward/record.uri?eid=2-s2.0-105006506164&doi=10.1109%2FTrustCom63139. 2024.00359&partnerID=40&md5=6a1191858aa7346ef48d19159a09185f.
19