Short-Term Passenger Flow Prediction of Urban Metro Based on Adaptive Fusion of Long Short-Term Memory-Transformer Dual Branches
Abstract:
Metro passenger flow combines a periodic commuting baseline with pulse peaks induced by multiple factors, and it therefore exhibits a dual-source statistical structure: a stable time series during off-peak periods and event-driven peak surges during event periods. To deal with this dual-source structure, we propose a short-term metro passenger flow prediction method that adaptively fuses two different encoding branches. The first is a historical time-series branch, in which we feed a Long Short-Term Memory (LSTM) network and a Transformer encoder with past flow records to learn the periodic regularity of passenger flow. The second is a future event branch, in which we apply one-hot encoding to external factors such as holiday features and predictable event features and use a Transformer to capture how scheduled exogenous events shift passenger flow away from its regular pattern. To combine the two branches, we introduce an event-aware Sigmoid gating mechanism that learns an adaptive weight for each branch according to the external event attributes. When no external event occurs, this gate assigns most of the weight to the historical time-series branch; when an external event is expected to trigger a peak, it increases the contribution of the future event branch. It outperforms every single branch for the direct multi-step 30-day-ahead passenger flow prediction task. Averaged over five independent runs, its Mean Absolute Error (MAE), Root Mean Square Error (RMSE) and Mean Absolute Percentage Error (MAPE) on the test set are 133,700 $\pm$ 4,200 passengers, 176,800 ± 5,700 passengers and 12.35 $\pm$ 0.31\%, respectively, which are lower than those of every single branch and of the compared baselines.1. Introduction
With the rapid development of urbanization, the metro, as an essential component of public transportation, plays a crucial role in alleviating traffic congestion and improving the urban transport environment. Meanwhile, the rapidly growing passenger flow has imposed higher demands on efficient dispatching and rational resource allocation by relevant authorities [1]. In this context, short-term passenger flow prediction at the metro serves as a critical foundation for metro capacity dispatching and allocation [2].
In recent years, deep learning methods have been extensively studied and applied to urban rail transit passenger flow prediction [3], [4]. Such models tend to optimize toward reducing Root Mean Square Error (RMSE), making them more sensitive to absolute errors in high-passenger-flow intervals [5]. However, under this training paradigm, the overall Mean Absolute Percentage Error (MAPE) remains at a relatively high level.
The Transformer architecture, centered on self-attention [6], [7], excels at capturing long-range global dependencies within time series and is well suited for modeling weekly periodic passenger flow patterns. Existing studies often combine the Transformer with local feature extractors such as the Temporal Convolutional Network (TCN) of Bai et al. [8] to build hybrid temporal frameworks that capture both local details and global correlations [9]. Du et al. [10] integrated the Graph Convolutional Network (GCN) with a transformer to construct a ResNet-GCN-Transformer model for multi-time-granularity metro short-term passenger flow prediction. Chen et al. [11] proposed a passenger flow prediction model that fuses GCN with an improved Informer.
Although these composite network structures enhance feature extraction capability and increase model parameter count, they still rely on a single loss function for training, which fails to fundamentally resolve the bi-objective optimization conflict between peak and off-peak prediction.
To address the bi-objective optimization conflict in metro passenger flow prediction—where prediction accuracy for stable intervals and peak intervals cannot be simultaneously optimized—this paper proposes a dual-branch adaptive fusion prediction model based on event-aware explicit gating decisions. The model architecture consists of two different branches and one gating unit:
(1) Historical time-series branch: Based on historical passenger flow time series, this branch adopts a Long Short-Term Memory (LSTM)-Transformer structure to mine inherent periodic and stable evolutionary patterns. It focuses on fitting steady passenger flow under disturbance-free scenarios, maintains prediction stability for baseline states, and avoids abnormal prediction fluctuations caused by external feature interference.
(2) Future event branch: This branch performs one-hot encoding and deep feature learning on multi-dimensional exogenous features, including holiday features and predictable event features. It captures nonlinear flow variations and periodic surges driven by external events, optimizes the fitting accuracy of event-induced passenger flow peaks, and compensates for the inability of pure time-series models to capture event-induced flow changes.
(3) Event-aware Sigmoid gating unit: Different from traditional implicit black-box fusion methods, this model introduces explicit event prior knowledge as the guiding signal and adopts constrained training. The Sigmoid gating unit dynamically adjusts dual-branch weights according to predefined event states. The model prioritizes temporal periodic rules under normal conditions and strengthens event feature modeling when pre-planned external factors induce flow variations.
This divide-and-conquer modeling framework realizes error complementary fusion guided by traffic domain priors. It mitigates the inherent optimization contradiction between stable interval fitting and peak value prediction existing in conventional single-branch models, as further supported by subsequent ablation experiments.
2. Influencing Factors of Metro Passenger Flow
Temporal regularity is the core endogenous feature governing metro passenger flow evolution. Figure 1 shows the weekly passenger flow patterns of three metro lines, revealing obvious weekly periodicity with lower ridership on workdays and higher volumes on weekends. Conventional approaches construct samples by segmenting the series into fixed-length windows, which breaks the continuity of the series and fragments the weekly cycle across samples. In this paper, we apply a refined time encoding that represents temporal information directly to solve this problem. With complete input sequences retained, the model adaptively learns weekly periodicity and long-term evolutionary rules, enhancing its ability to fit steady-state passenger-flow temporal regularities.

Meteorological conditions are crucial external factors affecting residents’ metro travel willingness [12], [13]. Variations in temperature and precipitation directly change public travel preferences. Fine weather facilitates commuting and sightseeing trips, whereas adverse weather restricts outdoor travel and alters the temporal distribution of metro passenger flow. Unlike periodic passenger flow patterns, climatic factors exhibit strong randomness. Despite their relatively weak overall influence, extreme weather can trigger abrupt and irregular passenger flow variations.
Holiday features are vital categorical features for distinguishing rigid commuter flow and flexible leisure flow [14], serving as core event variables that trigger structural changes in metro passenger flow. Workday passenger flow is dominated by regular commuting trips with stable trends and obvious peak-valley characteristics. In comparison, holiday and weekend passenger flow mainly consists of tourism, shopping, and visiting activities, presenting shifted peak hours and longer fluctuation durations. Such significant pattern differences between working and non-working days easily induce prediction bias in conventional time-series models. The incorporation of holiday features effectively differentiates rigid and flexible travel scenarios, enabling the model to accurately capture holiday-induced flow surges and peak shifts. This compensates for the poor adaptability of pure time-series methods in special-date scenarios. Figure 2 visualizes the holiday-driven passenger flow variations of three typical metro lines.

$\bullet$ Land-use context features. Land-use composition defines the functional attributes of an area and is a well-established determinant of metro travel demand [15]. It shapes the level and composition of demand rather than its day-to-day fluctuation: residential and industrial land supports regular commuting, whereas commercial, catering and scenic land supports leisure travel that varies over weekends and holidays. We represent it by the shares of each land-use category, aggregated at the city level, and each prediction sample is associated with the composition in effect on its target date. Because the composition describes the functional profile of the study area rather than the conditions of a particular day, we treat it as a near-static context input rather than an event signal; how it is handled in feature screening is described in Section 4.2. Figure 3 illustrates the spatial distribution of land-use categories in the study area.

$\bullet$ Predictable event features. These describe date-specific occurrences that are scheduled in advance, such as concerts, sports competitions, and other pre-planned large-scale activities [16]. Unlike the land-use context features, they vary from day to day and are fully known before the forecasting time, so they indicate which days are likely to depart from the regular weekly pattern. Together with holiday features, they form the event inputs of the future event branch and the event labels used by the gating constraint, and they are the features assessed by the correlation screening in Section 4.2.
3. Prediction Model and Evaluation Design
This section elaborates on the architecture of the proposed dual-branch prediction model and the corresponding evaluation design. First, we introduce the basic LSTM and Transformer modules as foundational feature extractors. Then, we describe the dual-branch encoding structure and the adaptive gating fusion module, which integrates historical time-series information and predictable exogenous features for metro passenger flow modeling. Finally, we give the definition of the composite loss function and prediction evaluation metrics used in this study.
The LSTM neural network (Figure 4) introduces a gating-based regulation mechanism into recurrent neural networks. It employs control units including the forget gate, input gate, and output gate to finely manage the information flow inside the network, alleviating gradient anomalies during deep training and effectively modeling long-range dependencies within time series. Therefore, it can learn the periodic dependencies of passenger flow series and capture local temporal variation characteristics of passenger flow evolution over time. Its core structure is described as follows.

The LSTM network captures short-term temporal dependencies of passenger flow through the collaborative work of four components, namely the forget gate, the input gate, the memory cell, and the output gate:
(1) The forget gate adaptively discards outdated, time-insensitive historical travel information.
(2) The input gate increases the update weight of key temporal features to effectively learn local flow variations such as sudden peaks and drops.
(3) The memory cell persistently retains long-term daily travel patterns and multi-day flow trends to sustain stable temporal states.
(4) The output gate filters valid temporal features based on optimized memory information and feeds refined hidden states into the subsequent Transformer module.
Taken together, these gates allow the LSTM to capture the short-term temporal dependencies of passenger flow and to pass a refined hidden-state representation, rich in local temporal information, to the Transformer encoder.
Transformer is a self-attention-based deep learning architecture that discards recurrent and convolutional structures to build global input-output dependencies. It performs parallel feature learning via self-attention and feed-forward networks, enabling efficient capture of complex sequence correlations and long-range temporal dependencies. This architecture well characterizes the intricate cross-time-step coupling relationships among metro passenger flow, historical fluctuations, periodic patterns and external events, and effectively mines the implicit evolutionary rules of time-series passenger flow data. This paper employs the Transformer encoder for local and global feature modeling, which is embedded in both the historical time-series branch and the future event branch to achieve fine-grained dual-branch feature representation. The core network structure is described in Figure 5.

(1) Attention Mechanism. The attention mechanism serves as the core component for the Transformer to extract deep features. By constructing dynamic correlation weights between different positions in the time series, it enables the model to autonomously focus on critical temporal segments and key event features, effectively improving the capture of long-range passenger flow dependencies. Its calculation procedure consists of three core steps: a. Vector projection generation: a linear transformation is performed on the input features of each branch via three groups of trainable projection matrices to generate the query vector $Q$, key vector $K$, and value vector $V$; b. Correlation weight calculation: the inner product of $Q$ and $K$ is computed to quantify the strength of temporal correlation, and standardized attention weights at each time step are obtained after Softmax normalization; c. Weighted summation: the value matrix $V$ is weighted and fused using the attention weights, and the temporal feature representation integrated with global context information is output. The calculation formula is given as follows.
where, $Q$, $K$, and $V$ denote the query matrix, key matrix, and value matrix, respectively; $d_k$ represents the dimension of the key vector, which scales the magnitude of dot products to prevent gradient vanishing.
(2) Multi-Head Attention Mechanism. On the basis of standard self-attention, the multi-head attention mechanism projects Q, K, and V into multiple feature subspaces in parallel. After multiple groups of self-attention are independently computed, the results are concatenated, fused and projected linearly for output. The parallel modeling strategy across multiple subspaces can mine diverse correlation patterns of passenger flow sequences from different feature dimensions, greatly enhancing the model’s feature representation capability and generalization performance. For the metro passenger flow prediction task, multi-head attention can capture multiple temporal rules in parallel: it can obtain short-term fluctuation trends of intra-day passenger flow and stable weekly travel cycles, and also accurately match passenger flow variation patterns corresponding to external events such as holidays and planned events. It compensates for the memory decay defect of LSTM for long sequences and achieves precise modeling of long-range temporal dependencies. The calculation formula of multi-head attention is shown as follows.
where, $W_{Q j}, W_{k s k}$, and $W_{V j}$ denote the query, key, and value projection matrices of the $i$-th attention head, respectively; Wo is the output fusion projection matrix for multi-head attention.
(3) Feed-Forward Network (FFN). The feed-forward neural network serves as the core nonlinear transformation component of the Transformer encoder. It performs independent high-dimensional nonlinear mapping for features at each time step of the sequence to mine deep implicit features and complex interaction patterns at individual time instants. In the passenger flow prediction task, the feed-forward network is responsible for fitting the nonlinear coupling relationships between temporal passenger flow features and event features. It can effectively adapt to the non-stationary and event-induced evolution characteristics of passenger flow and improve the model's adaptability to abnormal fluctuations and event disturbances. The network adopts a structure consisting of two linear layers combined with the ReLU activation function. It first maps features into a high-dimensional space to extract complex features, then projects them back to the original feature dimension to introduce nonlinear representational capacity. Its calculation formula is expressed as follows.
(1) Historical time-series encoding branch (Branch A). This encoding branch takes consecutive daily passenger flow time series as input. It adopts an LSTM to capture short-term temporal dependencies and local fluctuation features, and combines the Transformer encoder to mine long-range periodic correlations and global temporal patterns. This branch focuses on learning stable inherent passenger flow characteristics, including weekly periodicity and continuous variation trends. Relying on the stable continuity of historical flow data, it generates reliable baseline prediction representations, provides fundamental passenger flow trends, and ensures stable prediction performance under normal event-free scenarios.
(2) Future event encoding branch (Branch B). This encoding branch takes deterministically available future exogenous influencing factors as inputs. Categorical input features are converted via one-hot encoding prior to linear projection and Transformer encoding. This branch captures passenger flow variations induced by predictable external factors, learns holiday-driven flow patterns, and explores interactions among superimposed prior attributes, compensating for the limitation of pure time-series models lacking future prior information.
Definition of unified operational event: all event features adopted in Branch B inputs and gating constraint supervision are limited to predictable and deterministic prior factors, which are pre-known holiday features and predictable event features. Land-use context features are not part of this definition. Unpredictable traffic incidents, emergency information, and real-time uncertain events are excluded from the model.
(3) Adaptive gating fusion module. To dynamically balance stable temporal features and exogenous feature patterns, an adaptive gating fusion module is proposed to adjust the two-branch fusion weights according to future event attributes. Traditional fixed-weight fusion fails to distinguish flow differences between normal and event-affected days, resulting in inadequate fitting for event-related flow variations. In this module, the gating unit integrates historical features, future event features, and event marker features as comprehensive inputs. The Sigmoid function outputs 0–1 adaptive weight coefficients to implement soft weighted fusion of dual-branch features. The specific gating fusion formula is presented below.
where, $w$ denotes the gating fusion weight; $\sigma$ represents the Sigmoid activation function; Hhis is the feature of the historical time-series encoding branch; $H_{\text {fut }}$ is the feature of the future event encoding branch; $H_{\text{flag}}$ stands for the event marker of the future window; $H_{\text {final }}$ is the fused final feature representation. To optimize gating weight allocation, this model introduces an auxiliary gating constraint loss $L _ {\text{gate}}$ and adopts a multi-objective collaborative optimization strategy during training. The overall multi-objective loss function is formulated as:
where, Lured denotes the main prediction loss between model output and ground-truth passenger flow; $\lambda$ is the balance weight for auxiliary constraint loss, set to 0.25 in this work; N denotes sample size; $\mathbb{I}_{\text {non-event }}(i)$ and $\mathbb{I}_{\text {event }}(i)$ are indicator functions. $\mathbb{I}_{\text {non-event }}(i)=1$ when sample $i$ belongs to a non-event day and equals 0 otherwise; $\mathbb{I}_{\text {event }}(i)=1$ for days with predictable external factors and 0 otherwise. These labels are consistent with the predictable features fed into Branch B. Under event-free scenarios, the indicator $\mathbb{I}_{\text {non-event }}(i)$ activates and penalizes large $w_i$, suppressing the weight of the future-event branch to prioritize stable temporal pattern fitting. When predictable external factors such as holiday features and predictable event features exist, the constraint term dynamically increases the weight of the future-event branch, strengthens the modeling of exogenous predictable features, and improves the model's adaptive capability for passenger flow variations. The overall architecture of the proposed prediction model is illustrated in Figure 6.

The model inputs consist of the historical passenger flow time series and the exogenous features screened in Section 4.2. The training set (the first 256 windows, as described in Section 4.1) optimizes the model weights to learn the inherent periodic patterns of passenger flow and the characteristics of external disturbances.
Hyperparameters are optimized along three dimensions: architecture, training, and data. We vary the number of layers and the hidden dimension of the LSTM and Transformer modules so as to trade representational capacity against computational cost. For the training dimension, we use the Adam optimizer, whose learning rate and number of epochs are selected within the ranges listed in Table 1 and then held fixed during training.
We hold out the last 15% of the training set as an inner validation split. Each candidate configuration is trained on the remaining 85% of the training set and evaluated on the inner split, and the configuration that yields the lowest prediction error on the inner split is adopted. The selected configuration is listed in Table 1.
| Parameter Name | Search Range | Selected Value | Module | Description |
|---|---|---|---|---|
| Num Heads | 2–4 | 4 | Branch A, Branch B | Number of multi-head attention heads |
| Encoder layer | 1–3 | 2 | Branch A, Branch B | Number of Transformer encoder layers |
| LSTM layers | 1–3 | 2 | Branch A | Number of LSTM layers |
| LSTM Units | 32–128 | 64 | Branch A | LSTM hidden dimension |
| Train Ratio | 0.6–0.8 | 0.7 | Branch A, Branch B | Training set split ratio |
| Initial Learning Rate | 0.0001–0.001 | 0.001 | Branch A, Branch B | Initial learning rate |
| Epochs | 40–80 | 65 | Branch A, Branch B | Training epochs |
| Dropout | 0–0.3 | 0.1 | Branch A, Branch B | Network dropout rate |
This model adopts a composite loss strategy dominated by time-domain fitting loss. It accurately characterizes the amplitude and fluctuation trend deviations of passenger flow time series, adapts well to the non-stationary and multi-disturbance characteristics of metro passenger flow, and mitigates prediction bias caused by predictable external events. To construct a comprehensive evaluation system, Mean Absolute Error (MAE), RMSE, and Mean Absolute Percentage Error (MAPE) are adopted as core metrics. These indicators comprehensively quantify the model’s fitting accuracy and generalization ability from the perspectives of absolute error, error dispersion, and relative error. The specific calculation formulas are presented below.
where, $m$ denotes the total number of samples in the test set; $h\left(x_i\right)$ is the predicted passenger flow value; $y_i$ is the ground-truth measured passenger flow value. MAE characterizes the overall average prediction bias of the model; RMSE imposes stronger penalties on errors from abnormal fluctuations and reflects the model's capability to capture passenger flow peak scenarios; MAPE eliminates the influence of dimensional units and intuitively represents the overall prediction accuracy of the model. Smaller values of the three evaluation metrics indicate higher prediction precision and better fitting performance of the model.
4. Experiments
This paper analyzes the fluctuation characteristics of metro passenger flow in a provincial capital city of China. The prediction unit is city-level aggregated daily metro passenger flow. The city-level passenger flow time series contains 456 observations (covering January 2024 to March 2025), retrieved from the MetroDB database (https://metrodb.org). The observations from January 2024 to February 2025 form the development dataset, and March 2025 is reserved as an independent out-of-sample test set.
A separate line-level dataset with 1068 observations is collected from the “Deep Travel” WeChat mini-program for three representative metro lines (the city operates additional metro lines in total). This line-level dataset covers the full calendar year of 2024. It is only used for preliminary observation of potential external influencing factors and visualization in Figure 1 and Figure 2, and is not adopted for Pearson correlation screening, model training, or prediction.
Each sample consists of a 30-day look-back window and the 30 days that follow it, which the model is required to predict in a single forward pass, and the windows are generated with a stride of one day. Applied to the 425-day development dataset (January 2024–February 2025), this yields 366 windows in chronological order. The first 70% of the windows (256) form the training set. Because consecutive windows overlap, the target periods of the 29 windows that immediately follow the training set also overlap the training targets; these windows are therefore discarded and are not used for any result reported in this paper. The remaining 81 windows form the validation set, whose target periods cover 11 November 2024 to 28 February 2025 and lie entirely after the last training target. Hyperparameters are selected on the training set, and seed selection and the ablation experiments are conducted exclusively on these 81 validation windows. The March 2025 test set is excluded from model training, hyperparameter selection, and seed selection, and is used only to compare the predicted values with the ground truth.
No missing records exist in the collected datasets. Linear interpolation would be adopted to fill missing values if missing entries were encountered. The model is developed on a machine with an Intel i9-14900 processor, 32 GB of RAM, and an NVIDIA RTX 4060 GPU. Model training and prediction inference computations are also conducted on this hardware platform.
This section describes how we prepare the model input from the raw metro data of the development dataset. The procedure consists of outlier detection, screening of exogenous features, and encoding of the screened categorical event features.
(1) Outlier detection: This paper adopts the 3 $\sigma$ Pauta criterion to detect outliers in raw passenger flow data from this development dataset. A total of 16 abnormal samples are identified. Further verification indicates that these abnormal flow surges are authentic holiday-induced travel phenomena rather than data collection errors. Accordingly, this study retains all outlier samples and incorporates the corresponding holiday event information as exogenous features. This strategy enables the model to actively learn the intrinsic patterns of holiday passenger flow peaks. The same outlier screening rule is applied to the out-of-sample test set for consistency, and no data recording errors are found within the test samples.
(2) Screening of exogenous features: The Pearson correlation coefficient is calculated only on the training set to screen valid exogenous features, with screening criteria defined as $|r| >$ 0.5 and $p <$ 0.05. The correlation coefficients between climatic factors and passenger flow on the training set range from 0.12 to 0.31, which fail to meet the preset screening threshold. To further quantitatively verify the rationality of feature exclusion and avoid subjective empirical judgment, we conduct seed-averaged ablation experiments with fixed hyperparameters to compare model performance with and without climatic variables.
As reported in Table 2, the two variants of each comparison adopt fixed optimal hyperparameters and are evaluated on the validation set under the same experimental pipeline. The model without climatic features achieves distinctly lower prediction errors and better stability. Although climatic variables may potentially introduce nonlinear or lagged effects, the quantitative results clearly demonstrate that climatic features bring no performance gain but degrade prediction accuracy and stability. Therefore, climatic features are discarded to reduce dimensional redundancy and feature interference.
| Feature Setting | Number of Seeds | Mean $\boldsymbol{\pm}$ Std for $\boldsymbol{E_\textbf{RMSE}}$/10$\boldsymbol{^4}$ Passengers | Mean $\boldsymbol{\pm}$ Std for $\boldsymbol{E_\textbf{MAPE}}$/\% | Mean $\boldsymbol{\pm}$ Std for $\boldsymbol{E_\textbf{MAE}}$/10$\boldsymbol{^4}$ Passengers |
|---|---|---|---|---|
| With climatic features | 5 | 25.32 $\pm$ 2.88 | 18.82 $\pm$ 1.83\% | 21.56 $\pm$ 2.54 |
| Without climatic features (final feature set) | 5 | 18.00 $\pm$ 0.57 | 12.51 $\pm$ 0.53\% | 13.96 $\pm$ 0.65 |
| Final feature set without land-use context features | 5 | 18.38 $\pm$ 0.69 | 12.68 $\pm$ 0.61\% | 14.03 $\pm$ 0.73 |
In contrast, the predictable event features and holiday features satisfy our screening threshold, with their Pearson correlation coefficients calculated on the training subset ranging from 0.65–0.78 (predictable event features) and 0.79–0.87 (holiday). They are therefore selected as exogenous predictors since they capture stable external driving patterns closely linked to metro passenger flow variations. Land-use context features are not subject to this screening: because they are updated only three times within the training set and thus take four distinct values, a correlation coefficient against the daily flow would be determined by the three update dates rather than by a land-use–flow association. We therefore retain them as near-static context inputs and assess their contribution by ablation (Table 2): removing them slightly increases all three error metrics. As these features take a single value over the validation set, this difference cannot reflect day-to-day discrimination.
(3) Encoding of categorical event features: One-hot encoding is employed to convert screened categorical event features into standard binary vectors. This approach eliminates false numerical magnitude relationships among discrete categories, allows the network to independently learn the influence weight of each event type, and effectively captures the compound interaction effects of multiple superimposed external factors. The identical one-hot encoding mapping derived from the development dataset is applied to features in the out-of-sample test set.
To assess the sensitivity of the model to parameter initialization, five different random seeds (21, 22, 25, 27, 33) are adopted for independent training under identical dataset and hyperparameter settings. Table 3 reports the performance metrics of all five replicates evaluated on the 81 validation windows described in Section 4.1, along with their mean $\pm$ standard deviation, which reflects the performance variation induced by parameter initialization. No seed is selected for the quantitative comparison: the five runs are treated as repeated trials of the same configuration, and all tables report their mean $\pm$ standard deviation. The prediction curves in Figure 7, Figure 8, and Figure 9 are drawn for one representative run. The experimental results show limited metric dispersion over different seeds, indicating that the proposed model has low sensitivity to parameter initialization and favorable stability. The results are presented as follows.
Seed 21 | Seed 22 | Seed 25 | Seed 27 | Seed 33 | Mean $\boldsymbol{\pm}$ Std | |
|---|---|---|---|---|---|---|
$E_{\text{RMSE}}$/10$^4$ passengers | 18.33 | 18.44 | 17.56 | 17.21 | 18.44 | 18.00 $\pm$ 0.57 |
$E_{\text{MAPE}}$/% | 12.11% | 12.31% | 12.57% | 12.15% | 13.41% | 12.51 $\pm$ 0.53% |
$E_{\text{MAE}}$/10$^4$ passengers | 14.02 | 14.32 | 14.59 | 13.99 | 12.88 | 13.96 $\pm$ 0.65 |



The proposed model is used for the 30-day-ahead passenger flow prediction task for March 2025. The forecast starts on 28 February 2025 and covers 1–30 March 2025 (the 31st falling outside the fixed 30-day horizon), with the 30-day look-back window ending on the origin date. Taking the starting timestamp of prediction as the reference point, we calculate the MAPE between the predicted 30-day passenger flow sequence and the observed ground-truth sequence. The results are presented as follows.
Figure 7 shows the daily prediction error of one representative run over the 30-day test horizon. For this run, the average MAPE is 12.28% (the five-run mean is 12.35%, as described in Table 4). The highest single-point goodness-of-fit reaches 96.83%, calculated as $1-\frac{\left|\widehat{y}_1-y_i\right|}{y_i}$.
Model | Number of Seeds | Mean $\boldsymbol{\pm}$ Std for $\boldsymbol{E_\textbf{RMSE}}$/10$\boldsymbol{^4}$ Passengers | Mean $\boldsymbol{\pm}$ Std for $\boldsymbol{E_\textbf{MAPE}}$/\% | Mean $\boldsymbol{\pm}$ Std for $\boldsymbol{E_\textbf{MAE}}$/10$\boldsymbol{^4}$ Passengers |
|---|---|---|---|---|
SARIMAX | 66.84 | 43.26% | 54.55 | |
CNN | 5 | 33.86 $\pm$ 2.87 | 28.93 $\pm$ 2.59% | 27.05 $\pm$ 1.68 |
GRU | 5 | 33.83 $\pm$ 2.44 | 28.67 $\pm$ 2.09% | 26.34 $\pm$ 1.76 |
Standalone-LSTM | 5 | 26.82 $\pm$ 1.95 | 20.54 $\pm$ 1.97% | 23.65 $\pm$ 2.12 |
Standalone-Transformer | 5 | 24.59 $\pm$ 1.86 | 18.25 $\pm$ 1.57% | 21.83 $\pm$ 1.13 |
TCN-Transformer | 5 | 23.59 $\pm$ 2.15 | 17.67 $\pm$ 2.73% | 21.56 $\pm$ 2.31 |
Only Branch A (historical time-series branch) | 5 | 19.89 $\pm$ 0.56 | 14.97 $\pm$ 0.96% | 16.02 $\pm$ 1.02 |
Only Branch B (future event branch) | 5 | 24.97 $\pm$ 1.15 | 17.95 $\pm$ 0.69% | 20.02 $\pm$ 0.78 |
Dual-branch (fixed-weight fusion) | 5 | 18.52 $\pm$ 0.84 | 13.12 $\pm$ 0.65% | 14.01 $\pm$ 0.52 |
Dual-branch (without auxiliary $L_{\text {gate}}$ constraint) | 5 | 18.85 $\pm$ 1.03 | 13.49 $\pm$ 0.58% | 14.21 $\pm$ 0.85 |
Proposed model (ours) | 5 | 17.68 $\pm$ 0.57 | 12.35 $\pm$ 0.31% | 13.37 $\pm$ 0.42 |
This value corresponds to the point with the minimum relative error in the 30-day forecast sequence, and therefore reflects the best single point rather than the average accuracy over the horizon. Although the passenger flow is affected by multiple factors including historical time series, holiday features, and predictable event features, the overall prediction accuracy fluctuates to a certain extent. Nevertheless, the model maintains relatively stable prediction performance with reasonable error control, and achieves favorable overall prediction performance.
To demonstrate the prediction precision of the proposed model, Figure 8 plots the observed and predicted flow curves of the same representative run over the 30-day test window. It can be seen that the predicted curve is close to the actual passenger flow. The model not only fits the stable baseline passenger flow under normal working days, but also effectively predicts the amplitude and timing of passenger flow peaks induced by holidays and scheduled activities. Only a small number of points show slight deviations, which further indicates the good fitting capability of the dual-branch adaptive fusion model for both steady and peak passenger flow scenarios.
To demonstrate the efficacy of our model, we compare it against existing baselines and conduct ablation studies with different variations. Comparison groups include Convolutional Neural Network (CNN) [17], Gated Recurrent Unit (GRU) [18], Seasonal Auto-Regressive Integrated Moving Average with eXogenous inputs (SARIMAX) [19], TCN Transformer [9], standalone LSTM [20], standalone Transformer, dual branch with fixed weight fusion, and dual branch without auxiliary Lgate constraint. To fairly compare prediction accuracy and stability, all baseline models and ablation variants adopt identical chronological train-validation-test splitting, input feature sets, and independent hyperparameter tuning.
Table 5 reports the mean $\pm$ standard deviation over five random seeds for each model on the validation set, and Table 4 reports the corresponding values on the unseen March 2025 test set. All stochastic models are trained with the same five seeds; SARIMAX is deterministic and is reported as a single run.
Model | Number of Seeds | Mean $\boldsymbol{\pm}$ Std for $\boldsymbol{E_\textbf{RMSE}}$/10$\boldsymbol{^4}$ Passengers | Mean $\boldsymbol{\pm}$ Std for $\boldsymbol{E_\textbf{MAPE}}$/\% | Mean $\boldsymbol{\pm}$ Std for $\boldsymbol{E_\textbf{MAE}}$/10$\boldsymbol{^4}$ Passengers |
|---|---|---|---|---|
CNN | 5 | 35.82 $\pm$ 2.99 | 29.93 $\pm$ 2.81% | 27.87 $\pm$ 1.95 |
GRU | 5 | 34.02 $\pm$ 2.59 | 29.21 $\pm$ 1.99% | 26.92 $\pm$ 1.81 |
Standalone-LSTM | 5 | 27.59 $\pm$ 2.23 | 21.19 $\pm$ 2.25% | 23.97 $\pm$ 2.34 |
Standalone-Transformer | 5 | 25.30 $\pm$ 2.29 | 18.91 $\pm$ 1.80% | 22.95 $\pm$ 1.29 |
TCN-Transformer | 5 | 24.57 $\pm$ 2.53 | 18.03 $\pm$ 2.92% | 22.03 $\pm$ 2.99 |
Only Branch A (Historical time-series branch) | 5 | 20.01 $\pm$ 0.48 | 14.58 $\pm$ 1.05% | 16.67 $\pm$ 0.89 |
Only Branch B (Future event branch) | 5 | 25.66 $\pm$ 1.08 | 18.73 $\pm$ 0.75% | 20.35 $\pm$ 0.87 |
Dual-branch (fixed-weight fusion) | 5 | 19.97 $\pm$ 0.92 | 13.49 $\pm$ 0.63% | 14.18 $\pm$ 0.79 |
Dual-branch (without auxiliary $L_{\text {gate}}$ constraint) | 5 | 19.53 $\pm$ 1.20 | 13.26 $\pm$ 0.66% | 14.03 $\pm$ 1.01 |
Quantitative results in Table 4 demonstrate that our approach achieves lower prediction errors and competitive overall performance compared with all other models mentioned above. The proposed method better captures the complex and nonlinear fluctuating characteristics of metro passenger flow. In terms of curve fitting, the predicted sequence of the proposed model closely matches the real passenger flow trend, peak values, and fluctuation ranges. It reproduces event-related variations of passenger flow more closely than the compared models. By comparison, conventional models suffer from noticeable prediction lag and numerical deviation during drastic fluctuation periods and cannot effectively respond to aperiodic flow variations induced by predictable external factors. These results indicate that the dual-branch adaptive fusion model achieves the lowest prediction errors among the compared models on this test set.
To make the comparison reproducible, Table 6 summarises the architecture and tuning settings of the baseline models. Every model is trained on the same 256 training windows and evaluated on the same 81 validation windows and the same March 2025 test set, and the exogenous input is identical across models, consisting of the holiday features, the predictable event features and the land-use context features described in Section 2.4. SARIMAX is fitted with exactly the same exogenous variables and uses an Auto-Regressive Integrated Moving Average (ARIMA)(0, 1, 2) structure without a seasonal component. The ablation variants (Branch A only, Branch B only, fixed-weight fusion and the variant without the auxiliary gating constraint) are obtained by removing or replacing one component of the proposed model, and therefore share its architecture and hyperparameters as reported in Table 1.
| Model | Main Architecture | Specific Settings | Exogenous Input |
|---|---|---|---|
| SARIMAX | ARIMA with exogenous regressors | order (0, 1, 2); seasonal order (0, 0, 0, 0) | Holiday features, predictable event features, land-use context features |
| CNN | 1-D convolutional encoder + MLP head | 2 layers; 64 filters | Same |
| GRU | GRU encoder + MLP head | 2 layers; 64 units | Same |
| Standalone LSTM | LSTM encoder + MLP head | 2 layers; 64 units | Same |
| Standalone Transformer | Encoder-only Transformer + MLP head | 2 layers; 4 heads; $d$ = 64 | Same |
| TCN-Transformer | TCN front end (dilations 1, 2, 4) + Transformer encoder | 2 encoder layers; 4 heads; $d$ = 64 | Same |
All models are trained on the same 256 training windows and evaluated on the same 81 validation windows and the same March 2025 test set. Shared hyperparameters follow the search ranges and selected values in Table 1; only the parameters applicable to each architecture are listed.
Figure 9 compares the prediction errors of Branch A and Branch B under stable and non-stable periods. In this paper, stable periods are defined as ordinary workdays without holiday-related events; non-stable periods cover weekends, holidays, and dates with scheduled large-scale activity impacts. Land-use context features are retained as model inputs but are not considered as a factor when categorizing the two types of periods. For the representative run, the learned gating coefficient w yields 0.24 $\pm$ 0.12 for stable non-event samples and 0.71 $\pm$ 0.15 for holiday-driven non-stable samples. Branch A yields lower MAPE and RMSE in stable scenarios, demonstrating its capability to capture conventional passenger flow temporal evolution rules. In contrast, Branch B performs better on event-related and non-stable variations. These results indicate that the gate shifts weight toward Branch B on event-affected days, consistent with the complementary roles assumed for the two branches.
5. Conclusions
Metro passenger flow contains endogenous periodic commuting patterns and exogenous event-driven variations, which impose different prediction demands. Models trained with a single loss function tend to be biased toward one pattern. To address this issue, we propose a dual-branch prediction model. The historical time-series branch captures periodic endogenous passenger flow patterns, and the future-event branch uses holiday features and predictable event features to model exogenous flow variations. An event-aware Sigmoid gate adaptively fuses the two branches guided by predictable events. Ablation experiments confirm that the two branches exhibit complementary error distributions across different flow scenarios. Both fixed-weight fusion and removal of the auxiliary gating constraint lead to degraded prediction performance.
On the city-level daily dataset in the single-city case study, and averaged over five independent runs, the proposed model yields an MAE of 13.37 $\times$ 10$^4$ passengers, an RMSE of 17.68 $\times$ 10$^4$ passengers and a MAPE of 12.35% for 30-day direct multi-step prediction, with standard deviations of 0.42 $\times$ 10$^4$, 0.57 $\times$ 10$^4$ and 0.31%, respectively. These errors are lower than those of all single-branch structures and baseline models. However, the findings are constrained by the single-city setting and daily aggregated data. In addition, the out-of-sample evaluation rests on a single 30-day forecast origin, so the reported errors describe that forecast rather than a distribution over many origins. Variations in metro network scale, land-use composition and resident travel patterns across cities may alter model performance, so care should be taken when transferring this framework to other regions. Future work can introduce multi-period intraday passenger flow data and richer event annotations to support finer-grained prediction tasks.
Conceptualization, Z.F.L.; methodology, S.Z.L. and Z.F.L.; software, S.Z.L.; validation, S.Z.L.; formal analysis, S.Z.L.; investigation, S.Z.L.; data curation, S.Z.L.; writing—original draft preparation, S.Z.L.; writing—review and editing, Z.F.L.; visualization, S.Z.L.; supervision, Z.F.L.; project administration, Z.F.L. All authors have read and agreed to the published version of the manuscript.
The data used to support the research findings are available from the corresponding author upon request.
The authors declare no conflicts of interest.
