## 4 Experiment and Result Analysis
### Comparison Experiments and Analysis  
The test results with the two datasets are listed in Table 2. The MAE and RMSE of TaxiNYC are higher than those of BikeNYC, as the data scale of TaxiNYC is larger than that of BikeNYC. In both metrics, the statistical time series analysis methods HA and ARIMA have significantly larger prediction deviations than that of the LSTM method for both datasets. This indicates that manually extracting the temporal features cannot precisely obtain the nonlinear temporal correlations in traffic data. We take inflow data as an example. On the BikeNYC dataset, the ConvLSTM method has a lower RMSE and MAE than LSTM by 1.22% and 2.01%, respectively. On the TaxiNYC dataset, ConvLSTM outperforms LSTM with 7.59% lower RMSE and 5.61% lower MAE. This suggests that spatial and temporal correlations are more effective than temporal correlations alone, emphasizing the significance of modeling spatial dependencies between regions. On the BikeNYC dataset, we take the inflow data as an example, where our proposed approach outperforms ConvLSTM by 18.59% and 14.22%, and STDN by 9.49% and 2.17%, when it comes to capturing spatial and short-term/long-term temporal correlations. On the TaxiNYC dataset, our proposed method can achieve lower RMSE and MAE compared to ConvLSTM by 10.35% and 20.79%, and compared to STDN by 3.25% and 6.64%. It is noteworthy that STDN with an attention mechanism outperforms the ConvLSTM model. This observation confirms that the attention mechanism can be used to enhance the \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{3}{*}{**Methods**} & \multicolumn{4}{c}{**BikeNYC**} & \multicolumn{4}{c}{**TaxiNYC**} \\ \cline{2-9}  & \multicolumn{2}{c}{**Inflow**} & \multicolumn{2}{c}{**Outflow**} & \multicolumn{2}{c}{**Inflow**} & \multicolumn{2}{c}{**Outflow**} \\ \cline{2-9}  & **RMSE** & **MAE** & **RMSE** & **MAE** & **RMSE** & **MAE** & **RMSE** & **MAE** \\ \hline HA & 11.28 & 8.30 & 10.56 & 7.86 & 25.94 & 17.22 & 23.26 & 14.86 \\ ARIMA & 27.80 & 23.44 & 27.71 & 23.54 & 52.2 & 33.32 & 46.34 & 34.26 \\ LSTM & 9.85 & 6.96 & 9.42 & 6.86 & 19.76 & 13.55 & 16.56 & 12.01 \\ ConvLSTM & 9.73 & 6.82 & 9.42 & 6.81 & 18.26 & 12.79 & 16.27 & 11.20 \\ STDN & 8.75 & 5.98 & 8.21 & 6.22 & 16.92 & 10.85 & 15.42 & 8.76 \\ Our method & 7.92 & 5.85 & 7.83 & 6.12 & 16.37 & 10.13 & 14.86 & 8.34 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparison results conducted on BikeNYC and TaxiNYC datasets. capability of spatiotemporal feature extraction. Our approach is designed with a multi-head position attention module for extracting spatial features, which includes a multi-head time attention module to extract the temporal features and a bidirectional attention module to extract both the temporal and spatial features. This allows our model to have superior spatiotemporal prediction capability compared to the baseline models. The suboptimal performance of ConvLSTM may be attributed to its incapacity to completely exploit the potential spatiotemporal correlations in traffic flow data. Therefore, in order to improve the prediction accuracy, STDN makes an effort to capture spatial correlations as well as short- and long-duration temporal correlations via multi-perspective and long-term attention processes. However, the prediction accuracy is lower than that of the MRWG BiAtten due to the omitted effects of other events, including accidents in traffic flow. Our approach utilizes a random walk method based on a multi-graph attention mechanism to encode the accident data as spatial features to depict traffic congestion, and performs much better than the networks without the accident-encoding structure. As indicated in Table 3, the role of accident data in traffic flow prediction is evaluated via RMSE. The right two columns indicate whether the accident data module is considered; the majority of the aforementioned techniques perform better when the accident data are taken into account, particularly for models which take spatial correlations into account.