The ability to accurately perform counterfactual inference on time series is crucial for decision-making in fields like finance, healthcare, and marketing, as it allows us to understand the impact of events or treatments on outcomes over time. In this paper, we introduce a new counterfactual inference approach tailored to time series data impacted by market events, which is motivated by an industrial application. Utilizing the abduction-action-prediction procedure and the Structural Causal Model framework, we first adapt methods based on variational autoencoders and adversarial autoencoders, both previously used in counterfactual literature although not in time series settings. Then, we present the Conditional Entropy-Penalized Autoencoder (CEPAE), a novel autoencoder-based approach for counterfactual inference, which employs an entropy penalization loss over the latent space to encourage disentangled data representations. We validate our approach both theoretically and experimentally on synthetic, semi-synthetic, and real-world datasets, showing that CEPAE generally outperforms the other approaches in the evaluated metrics.
Figures & tables
Figure 1: Example of a time series counterfactual (cf) estimation comparison for our synthetic dataset among a baseline LSTM-based forecast model and CEPAE. The vertical line separates pre-event from post-event observations, counterfactual estimations and ground truth.
Figure 2: Problem setting’s computational graphs. Solid arrows denote direct influences on Y ; dotted double arrow reflects the abduction link. The confounded panel adds H→E .
Figure 3: Scheme of encoder-decoder based methods for counterfactual inference, both in training and counterfactual inference phase.
Model
Regularizer on Z
Practical implications
CVAE
KL divergence with fixed prior p(z)
Stable training with standard VAE machinery, but often poor reconstruction and insufficient disentanglement between Z and C , which can hurt counterfactual accuracy.
CAAE
Adversarial training on Z using an event discriminator.
Encourages disentanglement between Z and C and has good reconstruction, but inherits the instability and tuning difficulties of adversarial training.
CEPAE
Entropy penalty S(Z) .
Simple objective (no discriminator); encourages disentanglement between Z and C and has good reconstruction, having a stable training.
Table 1: Summary of the three encoder–decoder models used for counterfactual estimation. Here C denotes the conditioners (e.g., (h,e) ).
Synthetic
Conf. synth.
Semi-synth.
Real world
Metric
Method
0
1
0
1
0
1
0
1
Ground-truth metrics (synthetic and semi-synthetic only)
cf MAE ↓
LSTM
.199±.005
.198±.005
.199±.003
.201±.004
.101±.004
.080±.002
–
–
AB-LSTM
.201±.006
.197±.005
.202±.009
.202±.011
.103±.003
.083±.003
–
–
CVAE
.144±.021
.137±.014
.145±.007
.187±.017
.105±.005
.083±.004
–
–
CAAE
.087±.012
.083±.011
–
–
.065±.004
.061±.003
–
–
Table 2: Combined results across datasets for ef=0 and ef=1 (10 seeds). We evaluate both intervention directions: setting 0 where ef=0 and ecf=1 , and setting 1 where ef=1 and ecf=0 . Top block: ground-truth metrics (cf MAE/cf MBE; only available on synthetic and semi-synthetic datasets). Middle: Added Variations (Total/Altered Steps). Bottom: axiomatic metrics (Reconstruction, Reversibility, Effectiveness). “–” indicates not applicable (no counterfactual ground truth) or not reported due to unstable training.
Figure 4: Synthetic Control and Causal Impact comparison.
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
σ
MAE
0.0
0.004 0.002
0.1
0.045 0.002
0.3
0.077 0.001
1.0
0.114 0.002
1.5
0.128 0.002
Appendix
Table 3: MAE of the synthetic-control baseline for different noise standard deviations σ .
Figure 5: Convergence of CEPAE with a fixed EP weight of 0.09 on the unconfounded semi-synthetic dataset. We plot counterfactual MAE versus training epoch. The model converges slowly but reaches a stable low-error region around epoch 100.
Figure 6: Convergence of CEPAE with a linear schedule for the EP weight on the unconfounded semi-synthetic dataset. The EP weight increases linearly from 0 to 0.09 during the initial epochs. Counterfactual MAE decreases more rapidly than in the fixed-weight case and stabilizes around epoch 50.
Figure 7: Convergence of CAAE with a linear schedule for the adversarial weight on the unconfounded semi-synthetic dataset. The adversarial weight increases from 0 to 8.9 during training. After an initial drop in counterfactual MAE around epoch 50, the loss slowly increases again, illustrating the instability inherited from adversarial training.
Figure 8: Example of a failure mode for CAAE under a linear adversarial-weight schedule. At some point during training, the counterfactual MAE suddenly increases and remains high for the rest of the epochs, showing a typical instance of adversarial instability.
Figure 9: Convergence of CAAE with a fixed adversarial weight of 8.9 on the unconfounded semi-synthetic dataset. Without a schedule, the model fails to reach low-error regions and counterfactual MAE remains high throughout training.
Metric
Latent dimensionality Dz
6
7
8
9
10
11
12
MAE
0.062±0.004
0.058±0.003
0.056±0.004
0.051±0.003
0.049±0.004
0.055±0.004
0.051±0.004
MBE
−0.008±0.002
0.002±0.003
0.002±0.004
0.006±0.004
0.010±0.003
0.006±0.002
−0.003±0.002
Appendix
Table 4: Sensitivity of CEPAE to the latent dimensionality Dz on the unconfounded semi-synthetic dataset. We report counterfactual MAE and MBE (mean ± one standard deviation across seeds). The EP weight is fixed to 0.09 .
Metric
EP weight λEP
0.05
0.07
0.09
0.11
0.13
0.15
MAE
0.055±0.004
0.051±0.003
0.056±0.004
0.056±0.003
0.060±0.004
0.075±0.004
MBE
0.011±0.004
0.004±0.003
0.003±0.004
0.004±0.004
0.003±0.002
0.003±0.002
Appendix
Table 5: Sensitivity of CEPAE to the EP weight λEP on the unconfounded semi-synthetic dataset. We report counterfactual MAE and MBE (mean ± one standard deviation across seeds). The latent dimensionality is fixed to Dz=8 .
Causal counterfactual generation creates plausible alternative outcomes under interventions while preserving the relevant causal structure of a scenario.
Siebel School of Computing and Data Science, University of Illinois Urbana-Champaign · VinUni-Illinois Smart Health Center, VinUniversity · AI Innovation Institute, Stony Brook University +1