## 3 Methods
### Dual-Channel Deep Counterfactual Prediction Model for OD Matrix Prediction
#### 3.3.3 Loss Function and Prediction Accuracy Evaluation Metrics  
The dual-channel deep counterfactual prediction model is trained using a two-stage training strategy to effectively handle data sparsity and the distribution shifts between factual (normal) and counterfactual (incident-induced) scenarios. Both stages utilize Mean Squared Error (MSE) loss functions with added regularization terms to prevent overfitting and enhance model generalization. In the initial training stage, only factual data are employed to optimize the shared embedding parameters and the factual prediction branch parameters. The loss function is formulated as follows:  
\[\mathcal{L}_{1}=\frac{1}{|\mathcal{D}^{F}|}\sum_{(\mathbf{X}^{F},\mathbf{X}^{F})\in \mathcal{D}^{F}}\
orm{\hat{\mathbf{X}}^{F}-\mathbf{X}^{F}}_{2}^{2}+\lambda\
orm{\Theta }_{2}^{2} \tag{22}\]  
where \(\widetilde{\mathbf{X}}^{F}\) represents the predicted OD passenger flow under factual conditions, \(\mathbf{X}^{F}\) is the ground-truth OD flow matrix in normal operating scenarios, \(\mathcal{D}^{F}\) denotes the set of factual training samples, \(\Theta\) denotes the trainable model parameters for regulation term, and \(\lambda\) is the regularization coefficient. In the subsequent training stage, counterfactual data are incorporated to jointly optimize both factual and counterfactual branches. The loss function is expanded to simultaneously minimize prediction errors under both conditions, defined as:  
\[\mathcal{L}_{2}=\frac{1}{|\mathcal{D}^{F}|}\sum_{(\mathbf{X}^{F},\mathbf{X}^{F})\in \mathcal{D}^{F}}\
orm{\hat{\mathbf{X}}^{CF}-\mathbf{X}^{CF}}_{2}^{2}+\frac{1}{| \mathcal{D}^{CF}|}\sum_{(\mathbf{X}^{F},\mathbf{X}^{F})\in\mathcal{D}^{CF}}\
orm{\hat {\mathbf{X}}^{CF}-\mathbf{X}^{CF}}_{2}^{2}+\lambda\left(\
orm{\Theta^{F}}_{2}^{2}+ \
orm{\Theta^{CF}}_{2}^{2}\right) \tag{23}\]  
where \(\widetilde{\mathbf{X}}^{CF}\) is the counterfactual prediction, \(\mathbf{X}^{CF}\) represents the observed OD flows under incident scenarios, \(\mathcal{D}^{CF}\) is the set of counterfactual samples, and \(\Theta\) denote trainable parameters specific to factual and counterfactual prediction branches. To evaluate the model's predictive accuracy specifically under counterfactual (incident) scenarios, three metrics are adopted: Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), and Root Mean Square Error (RMSE). The corresponding formulas are defined as follows:  
\[\mathbf{MAE}=\frac{1}{|\mathcal{D}^{CF}|}\sum_{(\mathbf{X}^{F},\mathbf{X}^{F})\in \mathcal{D}^{CF}}\
orm{\hat{\mathbf{X}}^{CF}-\mathbf{X}^{CF}} \tag{24}\]  
\[\mathbf{MAPE}=\frac{1}{|\mathcal{D}^{CF}|}\sum_{(\mathbf{X}^{F},\mathbf{X}^{F})\in \mathcal{D}^{CF}}\
orm{\frac{\hat{\mathbf{X}}^{CF}-\mathbf{X}^{CF}}{\mathbf{X}^{CF}}}\times 100\% \tag{25}\]  
\[\mathbf{RMSE}=\sqrt{\frac{1}{|\mathcal{D}^{CF}|}}\sum_{(\mathbf{X}^{F},\mathbf{X}^{F}) \in\mathcal{D}^{CF}}\left(\hat{\mathbf{X}}^{CF}-\mathbf{X}^{CF}\right)^{2} \tag{26}\]  
These metrics provide comprehensive assessments of prediction errors in magnitude, proportional accuracy, and sensitivity to large deviations. The pseudocode for model training algorithm is provided in Algorithm 1.