SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Hodge-Laplacian Operator & Approximation. With the edge graph, we can perform edge convolution to filter edge signals that contain genuine causation for a node. The Hodge-Laplacian (HL) operator [16, 39] is a spectral operator defined on the boundary operator. The first-order HL operator is defined as:  $\mathbf{L} = \partial_2\partial_2^\top +\partial_1^\top \partial_1$ . Solving the eigensystem  $\mathbf{L}\psi^j = \lambda^j\psi^j$  produces orthonormal bases  $\{\psi^0,\psi^1,\psi^2,\ldots \}$ . The HL spectral filter  $h$  with spectrum  $h(\lambda)$  is defined as:  $h(\cdot ,\cdot) = \sum_{j = 0}^{\infty}h(\lambda^{j})\psi^{j}(\cdot)\psi^{j}(\cdot)$ . To approximate  $h(\lambda)$ , we follow [16] and expand it as a series of Laguerre polynomials  $T_{u}$  with learnable coefficients  $\theta_{u}$ :
$$
h (\lambda) = \sum_ {u = 0} ^ {U - 1} \theta_ {u} T _ {u} (\lambda), \tag {5}
$$
where  $T_{u}$  can be computed via the recurrence relation  $T_{u + 1}(\lambda) = \frac{(2u + 1 - \lambda) - uT_{u - 1}(\lambda)}{u + 1}$ , with initial states  $T_0(\lambda) = 1$  and  $T_{1}(\lambda) = 1 - \lambda$ . More details of these operators can be found in Appendix C.
Causation Filtering & Surrogate Variable. Shown in Figure 4b, the edge signal  $X_{ed}$  is mapped into the latent space by the edge encoder to obtain  $H_{ed} \in \mathbb{R}^{M \times F}$ . Next, we acquire a new causal relations representation  $\hat{H}_{ed} \in \mathbb{R}^{M \times F}$  by spectral filtering over  $H_{ed}$ :  $\hat{H}_{ed} = h * H_{ed} = \sum_{u=0}^{U-1} \theta_u T_u(\mathbf{L}) H_{ed}$ . We then use a linear transformer to calculate the causal strength  $A_{cau} \in \mathbb{R}^{N_e \times K_b}$  and derive  $\hat{H}_{ir} \in \mathbb{R}^{N \times F}$  using Graph Convolutional Networks (GCN), where nodes' information is filtered by their genuine causation.  $N_e$  and  $K_b$  are the numbers of causal relations (i.e., edges) and the GCN block's depth. Meanwhile, a position embedding  $P$  is used to generate  $\hat{H}_{ia} \in \mathbb{R}^{N \times F}$  via a linear transform. We then obtain the surrogate  $\hat{H}_i = \hat{H}_{ir} + \hat{H}_{ia}$ . Ultimately, we concatenate it with  $\hat{H}_e$  (obtained in Section 4.1) to form the predictor's input  $\hat{H}$  and obtain the final prediction  $\hat{Y}$ .
4.3 Optimization
Environment Codebook. We train the codebook following [46]. During forward computation, the nearest embedding  $\hat{H}_e$  is concatenated with the entity representation  $\hat{H}_i$  and fed to the decoder (i.e., predictor). In the backward pass, the gradient  $\nabla_z\mathcal{L}$  (see Figure 4c) is passed unaltered to the EnvEncoder within the Env Disentangler block. These gradients convey valuable information for adjusting the EnvEncoder's output to minimize the loss. The loss function has two components, namely the prediction loss  $\mathcal{L}_{pre}$  and the codebook loss  $\mathcal{L}_{cod}$ :
$$
\mathcal {L} _ {p r e} = - \log P (Y | \hat {H} _ {e}, \hat {H} _ {i}), \quad \mathcal {L} _ {c o d} = \left| \left| s g [ H _ {e} ] - e \right| \right| _ {2} ^ {2} + \alpha \left| \left| H _ {e} - s g [ e ] \right| \right| _ {2} ^ {2} \tag {6}
$$
where  $\alpha$  is a balancing hyperparameter and  $sg[\cdot]$  denotes the stopgradient operator, acting in a dual capacity - as an identity operator during forward computation, and has zero partial derivatives during the backward pass. As a result, it prevents its input from being updated. The predictor is optimized solely by  $\mathcal{L}_{pre}$ , whereas the EnvEncoder is optimized by both  $\mathcal{L}_{pre}$  and the second term of  $\mathcal{L}_{cod}$ . The first term of  $\mathcal{L}_{cod}$  optimizes the codebook.
Mutual Information Regularization. To minimize  $\mathcal{I}(H_i, H_e)$ , we use a classifier to predict  $z$  in Eq. 3 based on  $\hat{H}_i$ , denoted as  $\hat{z}$ . The objective is to thwart the classifier to discern the true labels, or in other terms, to ensure that the classifier can not determine the true corresponding environment based on the information provided by  $\hat{H}_i$ . To achieve this, we introduce the MI loss  $\mathcal{L}_{mi}$  that minimizes the cross-entropy between  $z$  and  $\hat{z}$  to encourage  $\hat{z}$  to move away from the true labels  $z$  and towards a uniform distribution:
$$
\mathcal {L} _ {m i} = \mathcal {I} \left(H _ {i}, H _ {e}\right) = \sum_ {k = 1} ^ {K} z ^ {k} \log \left(\hat {z} ^ {k}\right) \tag {7}
$$
where  $z^k$  and  $\hat{z}^k$  means labels belonging to  $e_k$ . The overall loss function is obtained by combining these three losses:  $\mathcal{L} = \mathcal{L}_{pre} + \mathcal{L}_{cod} + \beta \mathcal{L}_{mi}$ , where  $\beta$  regulates the trade-off of the MI loss.
Datasets & Baselines. We conduct experiments using three real-world datasets (PEMS08 [42], AIR-BJ [59], and AIR-GZ [59]) from two distinct domains to evaluate our proposed method. PEMS08 contains the traffic flow data in San Bernardino from Jul. to Aug. in 2016, with 170 detectors on 8 roads with a time interval of 5 minutes. AIR-BJ and AIR-GZ contain one-year  $\mathrm{PM}_{2.5}$  readings collected from air quality monitoring stations in Beijing and Guangzhou, respectively. Our task is to predict the next 24 steps based on the past 24 steps. For comparison, we select two classical methods (HA [63] and VAR [45]) and seven state-of-the-art STGNNs for STG forecasting, including DCRNN [26], STGCN [61], ASTGCN[14], MTGNN[55], AGCRN[1], GMSDR [30] and STGNCDE [5]. More details about the datasets and baselines can be found in Appendix D and E, respectively.
Implementation Details. We implement CaST and baselines with PyTorch 1.10.2 on a server with NVIDIA RTX A6000. We use the TCN [2] as the backbone encoder and a 3-layer MLP as the predictor and the classifier. Our model is trained using Adam optimizer [22] with a learning rate of 0.001 and a batch size of 64. For the hidden dimension  $F$ , we conduct a grid search over {8, 16, 32, 64}. For the number of layers in each convolutional block, we test it from 1 to 3. The codebook size  $K$  is searched over {5, 10, 20}. See the final setting of our model on each dataset in Appendix D.
5.1 Comparison to State-Of-The-Art Methods
We evaluate CaST and baselines in terms of Mean Absolute Error (MAE) and Root Mean Squared Error (RMSE), where lower metrics indicate better performance. Each method is executed five times, and we report the mean and standard deviation of both metrics for each model in Table 1. From this table, we have three key findings: 1) CaST clearly outperforms all competing baselines over the three datasets, whereas the second-best performing model is not consistent across all cases. This reveals that CaST demonstrates a more stable and reliable accuracy across various datasets, highlighting its versatility and adaptability to various domains. 2) STGNN-based models largely surpass conventional methods, i.e., HA and VAR, by virtue of their superior model capacity. 3) While baseline models such as AGCRN and MTGNN can achieve runner-up performance in certain cases, they exhibit a
Table 1: 5-run error comparison. The bold/underlined font means the best/the second-best result.
Model	PEMS08 (24→24)	AIR-BJ (24→24)	AIR-GZ (24→24)
MAE	RMSE	MAE	RMSE	MAE	RMSE
HA(2017)	58.83	81.96	32.12	43.95	19.56	25.77
VAR(1991)	37.04	53.08	29.79	42.04	14.97	20.61
DCRNN(2017)	22.10 ± 0.45	33.96 ± 0.59	23.72 ± 0.36	35.84 ± 0.56	12.99 ± 0.26	18.27 ± 0.41
STGCN(2018)	18.60 ± 0.08	28.44 ± 0.15	23.71 ± 0.21	36.30 ± 0.58	12.69 ± 0.04	17.66 ± 0.09
ASTGCN(2019)	20.36 ± 0.48	30.87 ± 0.55	23.78 ± 0.22	35.91 ± 0.11	12.91 ± 0.15	18.02 ± 0.27
MTGNN(2020)	18.13 ± 0.10	28.85 ± 0.12	24.35 ± 0.74	38.97 ± 1.81	12.43 ± 0.11	17.99 ± 0.18
AGCRN(2020)	17.06 ± 0.14	26.80 ± 0.15	23.43 ± 0.29	35.66 ± 0.57	12.74 ± 0.01	17.49 ± 0.01
GMSDR(2022)	18.34 ± 0.68	28.36 ± 1.01	25.92 ± 0.52	39.60 ± 0.44	13.47 ± 0.31	19.04 ± 0.46
STGNCDE(2022)	17.55 ± 0.30	27.28 ± 0.36	24.35 ± 0.31	35.91 ± 0.48	13.70 ± 0.10	19.15 ± 0.07
CaST (ours)	16.44 ± 0.10	26.61 ± 0.15	22.90 ± 0.09	34.84 ± 0.11	12.36 ± 0.01	17.25 ± 0.05
(a) Effects of Model Components
(b) Dynamic Causal Relations
Figure 5: (a) Effects of each core component on MAE. w/o: without. (b) Visualization of the dynamic causal relationships between nodes on AIR-BJ. (c) Distribution of air quality stations.
(c) Geographical Distribution
larger standard deviation compared to CaST. This demonstrates that CaST not only offers superior predictive accuracy but also showcases robustness and generalization capabilities. The evaluation of our proposed model confirms that incorporating causal tools not only enhances interpretability but also improves predictive accuracy and generalization performance across different scenarios. We also present the assessment of model performance on various future time steps in Appendix F.
5.2 Ablation Study & Interpretation Analysis
Effects of Core Components. To examine the effectiveness of each core component in our proposed model, we conducted an ablation study based on the following variants for comparison: a) w/o Env, which excludes environment features for prediction. b) w/o Ent, which omits entity features for prediction. c) w/o Edge, which does not utilize the causal score to guide the spatial message passing. The MAE results for two datasets, AIR-BJ and PEMs08, are displayed in Figure 5a. We observe that all components contribute to the model's performance. In addition, removing the entity component harms performance more than omitting the environment component, confirming our model's capacity to distinguish between the two. Moreover, removing the edge filtering affects PEMs08 more than AIR-BJ. This can be attributed to the unique properties of the down HL operator and the datasets, aligning better with the incompressible traffic flow of PEMs08 for causal capture, as opposed to AIR-BJ's non-divergence-free flow [40, 4]. A more detailed discussion can be found in Appendix G.
Effects of Edge Convolution. Our model utilizes a spectral filter on edges in the spatial de-confounding block, which enables it to capture the ripple effects of dynamic causal relationships. To validate the superiority of our edge convolution module over
Table 2: Variant results on MAE over AIR-BJ. s: steps.
Variant	Overall	1-8s	9-16s	17-24s
CaST-ADP	24.28	16.42	26.06	30.36
CaST-GAT	23.77	14.76	25.75	30.80
CaST	22.90	13.79	24.86	30.05
existing spatial learning methods, we conduct an ablation study on the AIR-BJ dataset by comparing the performance of CaST against two variants: CaST-ADP which replaces the edge convolution with a self-adaptive adjacency matrix [56], and CaST-GAT which employs the graph attention mechanism to obtain the causal score [47]. The results presented in Table 2 indicate that our edge convolution can adeptly discern the causal strengths between nodes, thereby resulting in enhanced performance.
Visualization of Dynamic Spatial Causation. To show the power of edge convolutions, we depict the trend of learned causal relations among four air quality stations in Beijing. Note that we do not incorporate any external features (e.g., weather and wind) as input. Considering the fact that the dispersion of air quality is strongly associated with wind direction, we select a one-week period in Nov. 2019, during which a south wind occurred on 11th Nov. The varying causal relations among the selected stations and their geolocations are displayed in Figures 5b and 5c. From them, three key observations can be obtained. Obs1: The causal relationships  $S_4 \rightarrow S_{14}$  and  $S_4 \rightarrow S_1$  exhibit similar patterns when there is a south wind, as  $S_1$  and  $S_{14}$  are both located south of  $S_4$ , which is reasonable to suggest that the causal relationship would be stronger in this case. Obs2:  $S_4 \rightarrow S_5$  shows an opposite changing direction compared to the former two relationships, as south winds carry  $\mathrm{PM}_{2.5}$  southward, resulting in the causal strength from  $S_4$  to eastern stations like  $S_5$ . Obs3:  $S_4 \rightarrow S_1$  and  $S_1 \rightarrow S_4$  display distinct patterns of change. While the causal strength from  $S_4$  to  $S_1$  increases with the occurrence of a south wind, that from  $S_1$  to  $S_4$  shows no significant change. The reason is that a south wind carries  $\mathrm{PM}_{2.5}$  towards the south, increasing its concentration in  $S_1$  and strengthening the causal relationship from  $S_4$  to  $S_1$ . However, the wind's effect is weaker in the opposite direction, leading to no significant changes in the causal strength from  $S_1$  to  $S_4$ . These findings underscore the capability of CaST to effectively capture the dynamic causal relationships among nodes.
(b) Frequency of Environments
(a) Environment Codebook
(c) External Factors of Environments
Analysis on Environmental Codebook. We employ the environmental codebook as a latent representation to address the temporal OoD issue. In Figure 7a, we visualize the environmental codebook vectors using PCA dimensional reduction with  $K = 10$  on AIR-BJ at different training epochs. Each color corresponds to a particular environment's embedding. Remarkably, starting from the same initialized positions, the
Figure 7: Case study on AIR-BJ (better viewed in color). (a) Environment codebook at different training epochs by PCA. (b) Distribution of environments for the station  $S_{31}$  in the train and test sets. Env: Environment. (c) The mean of temperature (Temp) and pressure (Press) in each environment.
Figure 6: Effects of  $K$  and  $F$  on AIR-BJ.
environment embeddings gradually diverge and move in distinct directions. Next, we assess the influence of several critical hyperparameters in CaST, including the hidden dimension  $F$  and the environment codebook size  $K$ . We examine how CaST performs on AIR-BJ while varying these hyperparameters and display the results in Figure 6. The empirical results indicate that the model's accuracy exhibits a lower sensitivity to the hidden size  $F$ . When the hidden size is small (i.e.,  $F < 32$ ), the performance is relatively unaffected by the choice of  $K$ . Consequently, the model is less reliant on the granularity of the environment representation, as provided by  $K$ , when the hidden size is small.
Interpretation of Temporal Environments. To further investigate what the codebook has learned, we visualize the environment types distribution of station  $S_{31}$  in the training set (Jan. - Aug. 2019) and testing set (Nov. - Dec. 2019) in Figure 7b. Note that the number of environments in the test set is computed as a sum of probabilities since we use the likelihood for each environment to generate unseen environments during the test phase. A substantial discrepancy in environmental distribution between the two sets is observed, with a significant increase in the occurrence frequency of  $e_7$  in the testing set compared to the training set, indicating the existence of a temporal distribution shift. As previously discussed, temporal environments are associated with related external factors that change over time. We then collect meteorological features in Beijing for 2019 and calculate the mean of two related variables, i.e., temperature and pressure, for each environment (see Figure 7c). We find that  $e_7$  is characterized by low temperature and high pressure, which is consistent with the fact that Nov. - Dec. typically exhibit lower temperatures and higher pressures compared to Jan. - Oct. The distribution of these variables in accordingly periods is presented in Appendix F. This highlights our model's capability to learn informative environment representations.
In this paper, we present the first attempt to jointly address the challenges of tackling the temporal OoD issue and modeling dynamic spatial causation in the STG forecasting task from a causal perspective. Building upon a structural causal model, we present a causal spatio-temporal neural network termed CaST that performs the back-door adjustment and front-door adjustment to resolve the two challenges, respectively. Extensive experiments over three datasets can verify the effectiveness, generalizability, and interpretability of our model. We provide more discussions in Appendix G, including the limitations of our model, potential future directions, and its social impacts.
This research is supported by Singapore Ministry of Education Academic Research Fund Tier 2 under MOE's official grant number T2EP20221-0023. This work is also supported by Guangzhou Municiple Science and Technology Project 2023A03J0011. We sincerely thank all reviewers for their insightful and constructive comments in improving this paper.
[1] Lei Bai, Lina Yao, Can Li, Xianzhi Wang, and Can Wang. 2020. Adaptive graph convolutional recurrent network for traffic forecasting. Advances in neural information processing systems 33 (2020), 17804-17815.
[2] Shaojie Bai, J Zico Kolter, and Vladlen Koltun. 2018. An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. arXiv preprint arXiv:1803.01271 (2018).
[3] Mohamed Ishmael Belghazi, Aristide Baratin, Sai Rajeshwar, Sherjil Ozair, Yoshua Bengio, Aaron Courville, and Devon Hjelm. 2018. Mutual information neural estimation. In International conference on machine learning. PMLR, 531-540.
[4] Yu-Chia Chen, Marina Meilă, and Ioannis G Kevrekidis. 2021. Helmholtzian Eigenmap: Topological feature discovery & edge flow learning from point cloud data. arXiv preprint arXiv:2103.07626 (2021).
[5] Jeongwhan Choi, Hwangyong Choi, Jeehyun Hwang, and Noseong Park. 2022. Graph neural controlled differential equations for traffic forecasting. In Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 36. 6367-6374.
[6] Yuntao Du, Jindong Wang, Wenjie Feng, Sinno Pan, Tao Qin, Renjun Xu, and Chongjun Wang. 2021. Adarnn: Adaptive learning and forecasting of time series. In Proceedings of the 30th ACM international conference on information & knowledge management. 402-411.
[7] Herbert Edelsbrunner, David Letscher, and Afra Zomorodian. 2000. Topological persistence and simplification. In Proceedings 41st annual symposium on foundations of computer science. IEEE, 454-463.
[8] Zheng Fang, Qingqing Long, Guojie Song, and Kunqing Xie. 2021. Spatial-temporal graph ode networks for traffic flow forecasting. In Proceedings of the 27th ACM SIGKDD conference on knowledge discovery & data mining. 364-373.
[9] Jie Feng, Yong Li, Zeyu Yang, Qiang Qiu, and Depeng Jin. 2020. Predicting human mobility with semantic motivation via multi-task attentional recurrent networks. IEEE Transactions on Knowledge and Data Engineering 34, 5 (2020), 2360-2374.
[10] Chen Gao, Yu Zheng, Wenjie Wang, Fuli Feng, Xiangnan He, and Yong Li. 2022. Causal inference in recommender systems: A survey and future directions. arXiv preprint arXiv:2208.12397 (2022).
[11] Xu Geng, Yaguang Li, Leye Wang, Lingyu Zhang, Qiang Yang, Jieping Ye, and Yan Liu. 2019. Spatiotemporal multi-graph convolution network for ride-hailing demand forecasting. In AAAI, Vol. 33. 3656-3663.
[12] Madelyn Glymour, Judea Pearl, and Nicholas P Jewell. 2016. Causal inference in statistics: A primer. John Wiley & Sons.
[13] Alex Graves. 2013. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850 (2013).
[14] Shengnan Guo, Youfang Lin, Ning Feng, Chao Song, and Huaiyu Wan. 2019. Attention based spatial-temporal graph convolutional networks for traffic flow forecasting. In Proceedings of the AAAI conference on artificial intelligence, Vol. 33. 922-929.
A Derivation of Back-door and Front-door Adjustment
We first introduce three basic rules of do-calculus  $do(\cdot)$ , then we present the derivation of back-door and front-door adjustment for the proposed SCM in Figure 2a based on these rules [36, 12].
Rules of Do-calculus. Let  $G$  be a directed acyclic graph with three nodes:  $X, Y$ , and  $Z$ . Denote the interventional graph as  $G_{do(X)}$ , which is identical to  $G$  except for the removal of all arrows leading to  $X$  from its parents. Denote the nullified graph as  $G_{null(X)}$ , where all arrows from  $X$  have been removed. For better understanding, we illustrate  $G, G_{do(X)}$  and  $G_{null(X)}$  in Figure 8.
(a)  $G$
Figure 8: Illustration of (a) directed acyclic graph, (b) interventional graph, and (c) nullified graph.
(b)  $G_{do(X)}$
(c)  $G_{\mathrm{null}(X)}$
Based on these definitions, we can introduce the following three rules of do-calculus[12]:
- Rule 1: Insertion/deletion of observations
$$
P (y | d o (x), z) = P (y | d o (x)), \quad \text {i f} (y \perp z | x) _ {G _ {d o (x)}}
$$
- Rule 2: Action/observation exchange
$$
P (y | d o (x), d o (z)) = P (y | d o (x), z), \quad \text {i f} (y \perp z | x) _ {G _ {d o (x), n u l l (z)}}
$$
- Rule 3: Insertion/deletion of actions
$$
P (y | d o (x), d o (z)) = P (y | d o (x)), \quad \text {i f} (y \perp z | x) _ {G _ {d o (x)}, d o (z)}
$$
where  $(y \perp z|x)_G$  means that  $y$  and  $z$  are independent of each other given  $x$  in  $G$ . For example, Rule 1 asserts that variables  $z$  can be removed from the conditioning set if the intervention variables  $x$  d-separate  $y$  from  $z$  in the intervention graph  $G_{do(x)}$ . Note that Figure 8 is an illustration of the definitions of  $G$  and its interventional and nullified counterparts, not mandatory for them to comply with these rules.
After introducing the definition, we shift our focus back to Figure 2 and apply the back-door and front-door adjustment on  $E$  and  $C$ , respectively.
Back-door Adjustment. We initially envisage a streamlined directed acyclic graph, where the environment  $E$  constitutes the sole parents of  $X$  (temporarily disregarding  $C$ ). By applying the rules of do-calculus, we can derive the back-door criterion as follows:
$$
\begin{array}{l} P (Y | d o (X)) = \sum_ {e} P (Y | d o (X), E = e) P (E = e | d o (X)) \quad (B a y e s R u l e) \\ = \sum_ {e} P (Y | d o (X), E = e) P (E = e) \quad (R u l e 3) \\ = \sum_ {e} P (Y | X, E = e) P (E = e) \quad \text {(R u l e 2)} \\ \end{array}
$$
By stratifying  $E$  into discrete components  $E = \{e_i\}_{i=1}^{|E|}$ , we can express the following:
$$
P (Y | d o (X)) = \sum_ {i = 1} ^ {| E |} P (Y | X, E = e _ {i}) P (E = e _ {i}) \tag {8}
$$
Front-door Adjustment. After de-confounding  $E$ , we have  $G_{\text{null}(E)}$ . Then, we turn our attention to the spatial confounder  $C$  via front-door adjustment as follows:
$$
\begin{array}{l} P (Y | d o (X)) = \sum_ {x ^ {*}} P (Y | d o (X ^ {*} = x ^ {*})) P (X ^ {*} = x ^ {*} | d o (X)) \quad \text {(B a y e s R u l e)} \\ = \sum_ {x ^ {*}} \sum_ {x ^ {\prime}} P \left(Y \mid X ^ {*} = x ^ {*}, X = x ^ {\prime}\right) P \left(X = x ^ {\prime}\right) P \left(X ^ {*} = x ^ {*} \mid d o (X)\right) \quad (B a y e s R u l e) \\ = \sum_ {x ^ {*}} \sum_ {x ^ {\prime}} P \left(X ^ {*} = x ^ {*} \mid X\right) P \left(Y \mid X ^ {*} = x ^ {*}, X = x ^ {\prime}\right) P \left(X = x ^ {\prime}\right) \tag {Rule2} \\ \end{array}
$$
B More Details of Env Disentangler
We devise the Env Disentagneler to capture the environmental and entity representations, as depicted in Figure 4a. The Env Disentangler comprises two distinct components: the EnvEncoder, which is responsible for capturing environmental information, and the EntEncoder, which focuses on extracting entity features. In the rest of this section, we will provide a detailed explanation of these components and their respective roles in our model.
EnvEncoder. We design the EnvEncoder (illustrated by the yellow block) to extract environment features. As we have previously discussed in Section 3, environmental factors can be subtle and often exhibit long-term changes, such as seasonal variations or policy shifts, our aim is to capture more global information from an input time series to better represent these underlying environmental influences. The EnvEncoder is comprised of a mixture of 1D convolutions with a kernel size of  $2^{i}$ ,  $i \in \{0,1,\dots,S_{k}\}$ , where  $S_{k}$  is a hyperparameter. These convolutions are followed by an average pooling layer and a linear projection to obtain the environment representation  $H_{e}$ .