## 2 Methods
### Sequence-to-Sequence Learning for Temporal Dynamics Modeling
Scheduled Sampling balances the use of the ground truth values and the model-generated inputs during training, which can make the model more robust when testing. A pseudo-code is presented in Algorithm 1. ``` Input: historical graph signals \((X^{(t-\delta+1)},\ldots,X^{(t)})\) and graph \(G=(V,E,M)\). Output: DCRNN model and future graph signals \(\left(X^{(t+1)},\ldots,X^{(t+0)}\right)\). 1. Define the topology of the bus transit network using a weighted graph \(G=(V,E,M)\). 2. Represent the volume of transit card transactions on \(G\) as a graph signal \(X\in\mathbb{R}^{N\times I}\), where \(N\) is the total number of bus lines and \(I\) is the number of features of each vertex. 3. Define a function \(\xi(\cdot)\) that maps \(\delta\) historical graph signals to \(o\) future graph signals, given graph \(G:\left(X^{(t-\delta+1)},\ldots,X^{(t)};G\right)\overset{\xi(\cdot)}{\to} \left(X^{(t+1)},\ldots,X^{(t+0)}\right)\). 4. Integrate diffusion convolution into a recurrent neural network to capture the spatiotemporal relationships: 1. Define a DCRNN structure. 2. Use a diffusion convolutional filter with a learnable parameter \(\theta\), the maximum number of diffusion steps \(Y\), and restart probability \(p\) to control the degree of diffusion. 3. Normalize the graph signals based on the adjacency matrix \(M\) in \(G\). 4. Apply the GDC layer on each feature of the graph signal \(X\) to obtain the output graph signal. 5. Combine GDC, RNN, and Seq2 Seq to achieve multi-step input and multi-step output prediction. 5. Train the model by maximizing the likelihood of generating the target future time series using backpropagation through time. With the spatial and temporal modeling structures described above, a DCRNN is built as shown in Figure 2. The network is trained by maximizing the likelihood of generating the target future time series using backpropagation through time. With the incorporation of both spatial and temporal dependencies along time series, the DCRNN captures the complex spatiotemporal patterns in various forecasting tasks. As a result, the DCRNN is applied for bus passenger flow prediction in a bus network. ## 3 Study Area and Data Processing

### Temporal Patterns of Daily Ridership

In this study, we focus on the bus network in Jiading District of Shanghai. The IC card transaction data from April 2021 to January 2022 are incorporated into this study. The data include the name of the bus line, the time of transaction, the bus fare, and the identification number of the IC card. The total daily ridership during the 10-month study period is presented in Figure 3. In the figure, we can find that the daily ridership roughly ranges from 80,000 (on weekends and holidays) to 14,000 (on workdays). Except for the great drop in bus ridership in late July 2021 caused by the landfall of Typhoon In-Fa, it presents a high regularity with recurrent patterns across the study period. The diurnal travel demand shares similar rhythms every week. To process the data for bus passenger flow prediction, the following steps are conducted. First, we aggregate the individual transaction records with a 15-min granularity and interpolate the missing or anomalous values. Second, considering the characteristics of

\[r_{t}=\sigma_{g}(W_{r}x_{t}+U_{r}h_{t-1}+b_{r}) \tag{7}\]0 Total daily ridership during the 10-month study period. \[r_{t}=\sigma_{g}(W_{r}x_{t}+U_{r}h_{t-1}+b_{r}) \tag{7}\]1 The architecture for the DCRNN for bus passenger flow prediction. bus schedules that normally operate the buses during the daytime with fixed first and last bus trip requirements, we retain the hours from 6:00 to 22:00 each day for prediction. Next, to construct the data into a specific format, a matrix with the size of \(m\times n\) is developed. In the matrix, the rows represent the dimension of time with a 15-min time interval for each row. The values in the y-axis refer to the total number of passengers boarding the bus on the corresponding bus line at each time interval.