# Dynamic Graph Representation Learning for Passenger Behavior Prediction
## 4 Methodology
### Temporal Sequence Construction
#### 4.1.2 Feature Encoder  
For each interaction \(e=(u,v,l,t)\), we first obtain the embeddings for each sequence with interaction features, time interval information, and temporal pattern behaviors. Then, we generate the fused representations for each passenger and station by aggregating these embeddings. **Interaction Encoder. ** Boarding and alighting, as key attributes of passenger-station interactions, are encoded into the interaction features. We use different labels to distinguish between boarding and alighting and write them into the raw features of the edges. Next,  
Figure 2: Framework of the DyGPP model. we use a replication padding method to expand the raw feature matrix of the edges, which serves as \(\mathbf{X}_{E}\) in the feature fusion. **Time Encoder. ** Passenger boarding and alighting behaviors usually exhibit strong periodicity and are highly correlated with time. We developed a time encoder to effectively utilize the time features in historical interaction information. Let the time encoding dimension be \(d\), the predicted timestamp be \(t\), and for passenger \(u\)'s neighbor \(s_{i}\) interacted at time \(t_{i}\), we use the \(\cos\left(\cdot\right)\) to transform the time interval \(\Delta t=t-t_{i}\) into a high-dimensional vector, and then represent the time interval using learnable parameters, followed by [32]. The formula is as follows:  
\[\mathbf{x}_{s_{i},time}^{t}=\sqrt{\frac{1}{d_{T}}}\big{[}\cos\left(\omega_{1} \Delta t\right),\cos\left(\omega_{2}\Delta t\right),\dots,\cos\left(\omega_{d_ {T}}\Delta t\right)\big{]}, \tag{1}\]  
where \(\mathbf{x}_{s_{i},time}^{t}\in\mathbb{R}^{d_{T}}\) and \(\mathbf{\omega}=[\omega_{1},\dots,\omega_{d_{T}}]^{T}\) represent the trainable parameters. Hence, the time interval embeddings for the sequence of the passenger and station are denoted as \(\mathbf{X}_{u,T}^{t}\) and \(\mathbf{X}_{s,T}^{t}\), respectively. **Temporal Pattern Encoding. ** The existing methods usually calculate the feature information of the passenger sequence and the station sequence separately, ignoring the correlation between the two nodes. We designed a module to consider both separate and cross-temporal patterns in these two sequences. It is worth noting that passenger nodes and station nodes are two different types of node. The historical first-order neighbors of a passenger node are always station nodes, and the historical first-order neighbors of a station node are always passenger nodes. In other words, the historical neighbor set of a passenger node can be denoted as \(\mathcal{N}_{s}^{t}=\{u\}\cup\{s_{1}^{t_{1}},\dots,s_{n}^{t_{n}}\mid t_{n}<t\}\), and the station nodes' neighbor set can be denoted as \(\mathcal{N}_{s}^{t}=\{s\}\cup\{u_{1}^{t_{1}},\dots,u_{n}^{t_{n}}\mid t^{u_{n}}<t\}\). On the one hand, to capture the separate temporal patterns, we calculate the interaction frequency of each neighbor in the individual sequence, which aims to learn the long-term temporal behaviors of passengers and stations. On the other hand, we learn the repeated interaction frequency between the passenger and target station in all other sequences. Specifically, we calculate the frequency at which passenger nodes appear in the historical neighbors of station nodes and the frequency at which station nodes appear in the historical neighbors of passenger nodes. The higher the frequency, the stronger the correlation between the two. In other words, if a station node \(u\) appears frequently in the historical neighbors of a passenger \(\mathcal{N}_{u}^{t}\), it is more likely that the passenger will interact with the station at time \(t\). Formally speaking, given the historical interaction sequence \(\mathcal{Q}_{u}^{t}\) for passengers and \(\mathcal{Q}_{s}^{t}\) for stations, we calculate the correlation between the two sequences, denoted as \(\mathbf{Co_{u}^{t}}\) and \(\mathbf{Co_{s}^{t}}\).