## 2 Methods
### Sequence-to-Sequence Learning for Temporal Dynamics Modeling
### Spatial Distribution and Construction of Graph for Bus Network

To study the spatial relationships among the bus lines, 59 bus routes are selected for this work with \(n=59\). The layout of the bus network is shown in \[r_{t}=\sigma_{g}(W_{r}x_{t}+U_{r}h_{t-1}+b_{r}) \tag{7}\]2 The figure also shows the average daily ridership of each bus line. It presents a clear pattern of spatial correlation of the bus ridership in different bus lines. The ridership in a bus line crossing or overlapping other high-demand bus lines is normally great as well, while the bus lines with low ridership cluster around the other low-ridership bus lines. To better capture the spatial patterns in bus demand evolution, the topological structure of the bus network is mapped, where a vertex represents a bus line, shown in Figure 5a. The weights of the edges are determined by the number of shared bus stops between the bus lines. We use a Standard Gaussian Kernel to build the adjacency matrix. A transformation is also performed on the numerical values based on multiple experiments:

\[M_{ij}=\left\{ \begin{array}{ll}\frac{2}{\exp\left(-\text{similarity}\left(v_{i} \cdot p_{j}\right)^{2}/\sigma^{2}\right)}-1&i\
eq j\\ 0&i=j\end{array} \right. \tag{14}\]

where \(M_{ij}\) represents the weight of the edge between bus line \(v_{i}\) and bus line \(v_{j}\); similarity\(\left(v_{i},v_{j}\right)\) denotes the common stops of line \(v_{i}\) and line \(v_{j}\); and \(\sigma\) is the standard deviation of stops. The adjacency matrix is visualized in Figure 5b. Figure 4: Bus network and the distribution of average daily ridership at bus line level. ## 4 Results and Discussion

### Metrics for Modeling Evaluation

We normalize the input data to ensure that each feature contributes equally to the analysis. The dataset is split into three subsets for training, testing, and validation, respectively. The DCRNN models are coded in Python 3.8 based on the PyTorch deep learning framework and are then loaded in an Ubuntu 20.04 server equipped with one Nvidia RTX 4090 and two Nvidia RTX 3090 graphics cards for training and tuning. In the proposed models, ReLU is employed as the activation function, while the loss function is defined based on the mean square error. We use Adam optimizer to train the weights of the neural network with Early-Stopping technique to enhance the effectiveness of training. After training, the models are tested and evaluated using the following statistical indices, which are the Mean Absolute Percentage Error (MAPE) expressed in Equation (15), t the Mean Absolute Error (MAE) expressed in Equation (16), and the Root Mean Square Error (RMSE) expressed in Equation (17). The MAPE is used to evaluate the accuracy of the model prediction in percentage, while MAE and RMSE measure the difference between the predicted and actual values [39]. \[\text{MAPE}=\frac{1}{n}\underset{i=1}{\overset{n}{\sum}}\left|\frac{\eta_{i}- \mu_{i}}{\eta_{i}}\right|\times 100\% \tag{15}\]

\[\text{MAE}=\frac{1}{n}\underset{i=1}{\overset{n}{\sum}}\left|\eta_{i}-\mu_{i}\right| \tag{16}\]

\[\text{RMSE}=\sqrt{\frac{1}{n}\underset{i=1}{\overset{n}{\sum}}\left(\eta_{i} -\mu_{i}\right)^{2}} \tag{17}\]

where \(\eta_{i}\) and \(\mu_{i}\) denote the actual ground truth values and the predicted values of the \(i\)-th data point, respectively; \(n\) is the number of data points; and \(v\) is the mean of the actual values. ### Modeling Results with Different Hyperparameters

The hyper-parameters are determined based on the performance of the model on the validated dataset. The results of four different sets of experiments--RNN hidden

Figure 5: (**a**) Graph visualization of 59 bus routes; (**b**) Visualization of adjacency matrix of the weighted graph. units, RNN layers, diffusion steps, and dropout--are presented in Table 1 and Figure 6. Specifically, in each set, we focus on one of the four key hyperparameters:

1.