Bus arrival time prediction method based on graph neural network and time-frequency mixed attention mechanism

The prediction method using graph neural networks and time-frequency hybrid attention mechanism solves the problem of insufficient utilization of time-frequency domain features in existing technologies, and achieves high-precision and stable prediction of travel time, adapting to the needs of complex traffic scenarios.

CN121503779APending Publication Date: 2026-02-10DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511647107.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-11
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing methods for predicting travel time between stations fail to fully utilize time-frequency domain features when dealing with complex traffic scenarios, resulting in insufficient prediction accuracy and stability, especially when data is scarce or labeling is difficult.

Method used

A prediction method based on graph neural networks and time-frequency hybrid attention mechanism is adopted. Through the TFHA-Transformer architecture and adaptive attention mechanism, the multi-scale time features and periodic evolution process of travel time are dynamically captured, so as to achieve accurate modeling and high-precision prediction of the factors affecting travel time.

Benefits of technology

It improves prediction accuracy and model adaptability, especially performing well in complex traffic scenarios, and enhances model stability and generalization ability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121503779A_ABST
    Figure CN121503779A_ABST
Patent Text Reader

Abstract

The invention provides a bus arrival time prediction method based on a graph neural network and a time-frequency mixed attention mechanism, and relates to the technical field of intelligent traffic. According to the inter-station travel time prediction method based on the time-frequency mixed attention mechanism, accurate modeling and high-precision prediction of travel time influence factors are realized through a TFHA-Transform architecture and a self-adaptive attention mechanism. According to the method, an inter-station travel time prediction task is reconstructed into a sequence regression problem on a time-frequency domain, and multi-scale time characteristics and a periodic evolution process of travel time are dynamically captured through an adaptive mechanism of a time-frequency mixed attention network. The new modeling norm not only improves the prediction precision, but also enhances the adaptability of the model to complex traffic scenes, and opens up a new direction for the development of the inter-station travel time prediction technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of intelligent transportation, and more particularly to a method for predicting bus arrival times based on graph neural networks and a time-frequency hybrid attention mechanism. Background Technology

[0002] In the field of intelligent transportation, inter-station travel time prediction has become a research hotspot. Travel time, as a core indicator of traffic flow and travel planning, has wide applications in intelligent bus scheduling, traffic congestion warning, and route planning. Previous supervised learning methods typically relied on large amounts of labeled travel time data for training; however, the effectiveness of supervised learning methods is significantly affected when data is scarce or labeling is difficult. In recent years, researchers have begun to focus on self-supervised learning-based inter-station travel time prediction methods, aiming to learn robust feature representations from unlabeled data to alleviate the tedious data labeling problem. Through self-supervised learning, the model can obtain more generalizable feature representations even without labeled data, overcoming the limitations of traditional supervised methods when data is scarce or labeling is difficult.

[0003] While existing self-supervised learning-based travel time prediction methods have achieved good results, they still face challenges in handling complex traffic scenarios due to the complexity of traffic flow and dynamic environmental changes. Although recent studies have attempted to combine time-domain and frequency-domain features to improve prediction performance, existing methods have not fully utilized the synergistic effect of these features and have certain shortcomings in the fusion of multimodal data. This may lead to the loss of important spatiotemporal features during modeling, affecting the accuracy and stability of the model's predictions. Therefore, how to effectively fuse time-domain and frequency-domain features to improve the accuracy and generalization ability of inter-station travel time prediction remains a pressing technical challenge in the field of intelligent transportation. Summary of the Invention

[0004] To address the technical problems mentioned in the background section, this invention provides a bus arrival time prediction method based on graph neural networks and a time-frequency hybrid attention mechanism. This invention's inter-station travel time prediction method, through a TFHA-Transformer architecture and an adaptive attention mechanism, achieves accurate modeling and high-precision prediction of factors influencing travel time. The method reconstructs the inter-station travel time prediction task as a sequence regression problem in the time-frequency domain, dynamically capturing the multi-scale temporal features and periodic evolution of travel time through the adaptive mechanism of the time-frequency hybrid attention network. This novel modeling paradigm not only improves prediction accuracy but also enhances the model's adaptability to complex traffic scenarios, opening up new directions for the development of inter-station travel time prediction technology.

[0005] The technical means employed in this invention are as follows: A bus arrival time prediction method based on graph neural networks and a time-frequency hybrid attention mechanism includes the following steps: Step 1: Spatiotemporal feature analysis and modeling of travel time; identify the correlation between travel time and frequency domain features, and establish a quantitative impact model; Step 2: Learning travel time features based on time-frequency hybrid attention mechanism. By constructing time-frequency domain feature representation and designing an adaptive attention mechanism, we can model complex travel time relationships. Step 3: Construct a complete prediction system by integrating time-frequency feature fusion, regression network design and training optimization algorithms.

[0006] Furthermore, in step 1, the travel time includes: historical travel time, traffic flow status, and road conditions.

[0007] Further, step 1 includes the following steps: Step 11: Correlation analysis between travel time and frequency domain characteristics using Fourier transform and spectral analysis; Step 12: Identify the periodicity of the time series during the identified travel time process; Step 13: Embed time features. Through multi-source data fusion and causal analysis, quantify the influence of various time factors on travel time. The time features include: timestamp, day of the week, holidays, and season.

[0008] Furthermore, in step 11, the correlation analysis between travel time and frequency domain characteristics is achieved through Fourier transform and spectral analysis: ; in, Indicates the first The travel time for each step of the journey. Indicates the first The amplitude of each frequency component Indicates the sequence length.

[0009] Furthermore, in step 12, the process of identifying travel time involves identifying periodic patterns in the time series; Assuming there exists in the travel time series The main cycles, travel time Represented as: ; in, Indicates trend components, Represents periodic components, Indicates noise components; The periodic components are modeled using Fourier series: ; in, Indicates the first The amplitude of each frequency component Indicates frequency, Indicates phase.

[0010] Furthermore, in step 13, the influence of the timestamp is modeled using sine and cosine coding: ; ; in, Indicates location, Representing dimension, Indicates the model dimension.

[0011] Furthermore, in step 2, the frequency domain attention module includes: low-frequency features and high-frequency features, as well as attention; the attention includes: frequency attention, phase attention, and amplitude attention; The low-frequency characteristics represent the main trends and long-term patterns of travel time: ; The high-frequency characteristics represent short-term fluctuations and noise in the travel time: ; The frequency attention refers to the importance of different frequency components to the prediction: ; in, This represents the learnable frequency weight matrix. Represents frequency domain characteristics; The attention weights of the frequency domain attention module are calculated based on the importance and correlation of the frequency components: ; in, and They represent frequencies respectively. and , Represents the frequency correlation function; The output of the frequency domain attention module is represented as follows: ; in, Represents the set of frequencies. Represents frequency Attention weights Represents frequency Its characteristics.

[0012] Furthermore, in step 2, the temporal attention module achieves adaptive temporal feature aggregation by calculating the influence weights of different time steps on the target time step; the calculation process of the temporal attention module includes three steps: feature transformation, attention calculation, and weight normalization. The feature transformation maps different types of time-domain features to the same feature space through a linear transformation: ; in, This represents the learnable weight matrix. Indicates time step The original feature vector; The attention calculation uses an attention function to determine the similarity between time steps. ; in, This represents a learnable attention vector. This represents a vector concatenation operation. This represents the activation function; weight normalization converts the attention scores into normalized weights using the softmax function. ; in, Indicates time step The neighborhood set; Multi-head temporal attention mechanisms enhance the expressive power of a model by computing multiple attention heads in parallel: ; The calculation for each attention head is as follows: ; in, Indicates the first The weight matrix of each attention head. Indicates the first The weight of each attention head; Hybrid attention weight calculation is performed by stacking multiple time-frequency hybrid attention layers to progressively learn time-frequency feature representations from local to global perspectives; the feature update formula for each time-frequency hybrid attention layer is: ; in, Indicates time step In the The feature vector of the layer, Indicates the first Attention weights of layers Indicates the first The weight matrix of the layer, Indicates the activation function; The design of time-frequency hybrid attention follows the principles of residual connections and layer normalization to improve training stability and feature representation ability. ; in It is a layer normalization operation. Indicates the first Time-frequency hybrid attention operation of the layer; The feature extraction process employs a hierarchical aggregation strategy, with different layers learning time-frequency features of different granularities: the first layer learns local time-domain features, capturing travel time patterns between adjacent time steps; the second layer learns medium-range features, capturing daily-cycle-level travel time patterns; and the third layer learns global features, capturing travel time patterns across the entire transportation network. The fusion of these mixed features is achieved through an adaptive weighting mechanism. ; in, Indicates the first The time-frequency fusion weights of the layers are calculated through an attention mechanism: .

[0013] Furthermore, in step 3, multi-scale feature aggregation is achieved by weighted combination of features from different attention layers. Low-level features capture short-term travel time fluctuations, while high-level features capture long-term traffic pattern changes. Adaptive fusion is achieved through a gating mechanism. ; in, Indicates the first Time-frequency characteristics of the layer Indicates the first Layer fusion weights.

[0014] Furthermore, the gating mechanism is implemented through an attention mechanism, and the softmax function ensures that the sum of the weights at all levels is 1. ; in, It represents the global time-frequency characteristics, obtained through global average pooling.

[0015] Compared with the prior art, the present invention has the following advantages: The method of this invention effectively improves prediction accuracy by adaptively learning time-frequency features, especially demonstrating excellent performance in periodic variations and complex traffic scenarios. Secondly, the time-frequency hybrid attention mechanism overcomes the limitations of traditional methods in handling complex nonlinear spatiotemporal dependencies and periodic patterns, enhancing the model's adaptability and stability. Finally, the method of this invention can improve the model's generalization ability and maintain high predictive performance under various traffic conditions, showing promising prospects for practical applications. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a schematic diagram of the inter-station travel time prediction based on the time-frequency hybrid attention mechanism of the present invention.

[0018] Figure 2 This is a training result diagram of the GAT model of this invention.

[0019] Figure 3 This is a diagram of the GAT ablation experiment of the present invention.

[0020] Figure 4 This is a regression prediction diagram of the inter-station travel distance in this invention.

[0021] Figure 5 This is a comparison chart of errors at different time periods. Detailed Implementation

[0022] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0024] like Figure 1 As shown, this invention provides a method for predicting bus arrival times based on graph neural networks and a time-frequency hybrid attention mechanism, comprising the following steps: Step 1: Spatiotemporal feature analysis and modeling of travel time; identify the correlation between travel time and frequency domain features, and establish a quantitative impact model; Step 2: Learning travel time features based on time-frequency hybrid attention mechanism. By constructing time-frequency domain feature representation and designing an adaptive attention mechanism, we can model complex travel time relationships. Step 3: Construct a complete prediction system by integrating time-frequency feature fusion, regression network design and training optimization algorithms.

[0025] As a preferred embodiment, this application employs multi-dimensional data analysis and statistical modeling to deeply understand the key factors influencing travel time between bus stops. This analysis not only provides a theoretical foundation for subsequent time-frequency hybrid attention network modeling but also offers important guidance for feature engineering and model optimization.

[0026] Step 11: The core of the Discrete Fourier Transform (DFT) of travel time series lies in identifying the correlation between travel time patterns and frequency domain features, and establishing a quantifiable impact model. Travel time data includes key indicators such as historical travel times, traffic flow conditions, and road conditions, which directly affect the prediction accuracy of inter-station travel times. The correlation analysis between travel time and frequency domain features is achieved through Fourier transform and spectral analysis:

[0027] in Indicates the first The travel time for each step of the journey. Indicates the first The amplitude of each frequency component Indicates the sequence length.

[0028] Spectral analysis of the travel time series revealed several important patterns: the frequency of travel time variation during peak hours is significantly higher than that during off-peak hours, resulting in more complex frequency domain characteristics; and there are significant differences in the spectral characteristics of travel time for different routes, requiring targeted modeling strategies.

[0029] To more accurately model the frequency domain effects, short-time Fourier transform and wavelet transform methods were employed. Short-time Fourier transform can capture the time-varying relationship between travel time and frequency domain features, while wavelet transform employs multi-scale analysis, which can better adapt to the complex distribution of travel time data.

[0030] Step 12: The core of periodic travel pattern recognition lies in understanding the periodicity in travel time series and the impact of this pattern on prediction accuracy. Various periodic patterns exist in travel time series, including daily, weekly, and seasonal cycles, which directly affect the accuracy of travel time prediction.

[0031] The mathematical modeling of periodic travel patterns is based on Fourier analysis and a period detection framework. It is assumed that there exists a periodicity in the travel time series. The main cycles, travel time It can be represented as: ; in Indicates trend components, Represents periodic components, This represents the noise component.

[0032] The periodic components are modeled using Fourier series: ; in Indicates the first The amplitude of each frequency component Indicates frequency, Indicates phase.

[0033] The identification of periodic travel patterns is achieved through power spectral density analysis and autocorrelation function (ACF). Power spectral density can identify the main frequency components, while ACCF can detect the presence of periodicity. This modeling approach can effectively capture complex periodic patterns in travel time series.

[0034] Step 13: Design of Time Feature Embedding Mechanism. Through multi-source data fusion and causal analysis, the influence of various time factors on travel time is quantified. Time features include timestamps, days of the week, holidays, seasons, etc., and these factors affect travel time through different mechanisms.

[0035] The impact of timestamps is modeled using sine and cosine coding: ; ; in Indicates location, Representing dimension, Indicates the model dimension.

[0036] The effects of days of the week and holidays are modeled using one-hot encoding and embedding vectors, while the effects of seasons are modeled using periodic encoding. The embedding mechanism of temporal features is implemented using a multilayer perceptron, taking into account the interdependencies between features. This modeling approach can effectively capture complex temporal influence patterns.

[0037] In this application, step 2, the travel time feature learning based on a time-frequency hybrid attention mechanism, achieves accurate modeling of complex travel time relationships by constructing time-frequency domain feature representations and designing an adaptive attention mechanism. This method can effectively capture the time-frequency domain dependencies of travel times, providing high-quality time-frequency feature representations for travel time prediction.

[0038] The design of the frequency domain attention module is the core foundation of the time-frequency hybrid attention mechanism. It models complex travel-time relationships by defining different types of frequency domain features and attention weights. The frequency domain attention module includes two types of features: low-frequency features and high-frequency features, and three types of attention: frequency attention, phase attention, and amplitude attention.

[0039] Low-frequency characteristics indicate the main trends and long-term patterns in travel time: ; High-frequency characteristics represent short-term fluctuations and noise in travel time: ; Frequency attention represents the importance of different frequency components to the prediction: ; in This represents the learnable frequency weight matrix. It represents the frequency domain characteristics.

[0040] The attention weights in the frequency domain attention module are calculated based on the importance and relevance of the frequency components: ; in and They are frequencies and , It is a frequency correlation function.

[0041] The output of the frequency domain attention module can be expressed as: ; in Represents the set of frequencies. Represents frequency Attention weights Represents frequency Its characteristics.

[0042] The temporal attention module is the core mechanism of TFHA. It achieves adaptive temporal feature aggregation by calculating the influence weights of different time steps on the target time step. The calculation process of temporal attention includes three steps: feature transformation, attention calculation, and weight normalization.

[0043] Feature transformation maps different types of time-domain features to the same feature space through linear transformation: ; in This represents the learnable weight matrix. Indicates time step The original feature vector.

[0044] Attention computation calculates the similarity between time steps using an attention function: ; in This represents a learnable attention vector. This represents a vector concatenation operation. This represents the activation function. Weight normalization converts the attention scores into normalized weights using the softmax function: ; in Indicates time step The neighborhood set. Multi-head temporal attention mechanisms enhance the model's expressive power by computing multiple attention heads in parallel: ; The calculation for each attention head is as follows: ; Where $ It is the first The weight matrix of each attention head. It is the first The weight of each attention head.

[0045] Hybrid attention weight calculation involves stacking multiple time-frequency hybrid attention layers to progressively learn time-frequency feature representations from local to global perspectives. The feature update formula for each time-frequency hybrid attention layer is: ; in Indicates time step In the The feature vector of the layer, Indicates the first Attention weights of layers Indicates the first The weight matrix of the layer, This represents the activation function.

[0046] The design of time-frequency hybrid attention follows the principles of residual connections and layer normalization to improve training stability and feature representation ability. ; in Presentation layer normalization operation, Indicates the first Layered time-frequency hybrid attention operation. The feature extraction process employs a hierarchical aggregation strategy, with different layers learning time-frequency features of different granularities: Layer 1 learns local time-domain features, capturing travel time patterns between adjacent time steps; Layer 2 learns medium-range features, capturing daily-cycle-level travel time patterns; Layer 3 learns global features, capturing travel time patterns across the entire transportation network. The fusion of hybrid features is achieved through an adaptive weighting mechanism. ; in Indicates the first The time-frequency fusion weights of the layers are calculated through an attention mechanism: ; This hybrid attention mechanism ensures that the model can capture both temporal details and frequency patterns simultaneously, providing rich time-frequency feature representations for travel time prediction.

[0047] In a preferred embodiment, step 3 involves designing and implementing an inter-station travel time prediction model by integrating time-frequency feature fusion, regression network design, and training optimization algorithms to construct a complete prediction system. This model effectively utilizes time-frequency features and time series information to achieve high-precision travel time prediction.

[0048] The core of the spatiotemporal hybrid gating mechanism design lies in effectively integrating time-frequency attention features from different levels to form a unified feature representation for final prediction. The gating mechanism employs multi-scale feature aggregation and adaptive weight allocation, which can automatically adjust the importance of features at each level according to different traffic scenarios and time periods.

[0049] Multi-scale feature aggregation is achieved by weighted combination of features from different attention layers. This design can fully utilize multi-level time-frequency information from local to global perspectives. Low-level features capture short-term travel time fluctuations, while high-level features capture long-term traffic pattern changes. Adaptive fusion is achieved through a gating mechanism. ; in Indicates the first Time-frequency characteristics of the layer Indicates the first Layer fusion weights.

[0050] The gating weights are calculated using an attention mechanism, considering both the quality and importance of features. This mechanism dynamically adjusts the contribution of features at different levels based on the current traffic conditions, focusing more on local features during congested periods and more on global features during smooth traffic. The weight calculation process uses a softmax function to ensure that the sum of the weights at all levels is 1, guaranteeing the stability of feature fusion. ; in These are global time-frequency features, obtained through global average pooling. The gating mechanism also considers feature complementarity and redundancy, optimizing the fusion strategy by maximizing mutual information to ensure that features at different levels can effectively contribute to the final prediction result. This design enables the model to adapt to the feature requirements of different traffic scenarios, improving the robustness and accuracy of the prediction.

[0051] The adaptive weight learning in travel time prediction employs a deep neural network architecture to map the fused time-frequency features to travel time prediction values. The network design includes three parts: feature encoding, nonlinear transformation, and regression output, each optimized for the characteristics of travel time prediction.

[0052] The feature encoding part maps time-frequency features to a high-dimensional representation space using a multilayer perceptron. This process transforms complex time-frequency relationships into more easily tractable numerical representations. The network employs a three-layer fully connected structure, with each layer using the ReLU activation function to enhance nonlinear expressiveness, while dropout is used to prevent overfitting. ; in and These represent the time-frequency weight matrix and bias vector of the first layer, respectively.

[0053] The nonlinear transformation section employs residual connections and batch normalization to enhance the network's expressive power and training stability. Residual connections alleviate the vanishing gradient problem in deep networks, while batch normalization accelerates training convergence and improves the model's generalization ability. This design is particularly suitable for handling time-series data with complex nonlinear relationships, such as travel time. ; The regression output maps high-dimensional features to travel time predictions via linear transformation. To ensure the reasonableness of the predictions, the output layer uses the ReLU activation function to guarantee non-negativity. The network design also considers the importance of different influencing factors, using an attention mechanism to weight features and ensure that external information such as environmental factors is effectively incorporated into the prediction process. The entire network architecture, trained end-to-end, can automatically learn the optimal feature representation and prediction strategy.

[0054] The multi-dimensional feature fusion method employs a multi-objective loss function and an adaptive learning rate strategy to ensure stable convergence and optimal performance of the model. The loss function design considers three objectives: prediction accuracy, time-frequency consistency, and temporal continuity. This multi-objective optimization strategy ensures that the model not only predicts accurately but also maintains consistency in the time-frequency domain and the smoothness of the time series.

[0055] The mathematical representation of the multi-objective loss function is: ; in This represents the time-frequency mean square error loss, used to measure the difference between the predicted and the actual values. This represents the temporal consistency loss, ensuring consistency in prediction results between adjacent time steps and avoiding unreasonable jumps in prediction results. This represents the frequency domain consistency loss, ensuring that the prediction results are smooth in the frequency domain and maintaining the periodicity of the travel time.

[0056] The temporal consistency loss design takes into account the continuity of travel time, maintaining the smoothness of the time series by constraining the prediction differences between adjacent time steps: ; The optimization algorithm employs the Adam optimizer, combined with learning rate scheduling and gradient pruning strategies. The learning rate scheduling uses a cosine annealing strategy, gradually reducing the learning rate during training. This strategy enables rapid convergence in the early stages of training and fine-tuning in the later stages. The training process also utilizes early stopping and model ensemble techniques to improve generalization ability. Early stopping prevents overfitting by monitoring the validation set loss, while model ensemble further improves the stability and accuracy of predictions by training multiple models with different initializations and averaging the prediction results, as shown in Table 1.

[0057] Table 1. Comparison of Station Dwell Time Prediction (MAE) (s) by Method.

[0058] In-depth analysis of the experimental results reveals that the method of this invention achieves a significant performance improvement in the station stop time prediction task. This is mainly attributed to the following aspects: First, in terms of prediction accuracy, the method of this invention improves by 42.1 percentage points compared to the traditional SVR method. This significant improvement is primarily due to the multi-scale feature fusion mechanism of the graph attention network. Traditional prediction methods typically employ single-dimensional feature extraction, which is easily affected by background noise and local feature similarity, leading to mispredictions in complex traffic scenarios. In contrast, the graph attention network of this invention, by fusing feature information from different stations, can more comprehensively capture multi-level feature representations of stop time, from coarse station type to fine passenger flow patterns. This multi-scale feature fusion significantly improves prediction accuracy.

[0059] Figure 2 The results demonstrate the changes in RMSE and MAE of the GAT model on the training and validation sets over training epochs. The results show that both types of errors gradually decrease as training progresses, stabilizing around 50 epochs. The curves on the training and validation sets show a high degree of consistency, with minimal difference between them, indicating that the model converges effectively without significant overfitting. Ultimately, the RMSE stabilizes at approximately 2.8, and the MAE stabilizes at approximately 2.1, demonstrating that the proposed GAT model possesses good fitting ability and generalization performance.

[0060] Figure 3 The RMSE comparison results under different model configurations are presented. Using models without graph structure and without attention mechanisms as control groups, it can be observed that the complete GAT model achieved the lowest error value throughout the training process, ultimately reducing the RMSE to approximately 3.2, demonstrating the best performance. When the attention mechanism is removed, the model error significantly increases to approximately 5.0, indicating that the attention mechanism plays a crucial role in feature weighting and information interaction. When the graph structure is removed, the error is approximately 4.0, which is better than the model without attention mechanism but still worse than the complete model, further validating the importance of graph structure in capturing temporal dependencies. In contrast, the performance of the LSTM baseline model consistently lags behind graph structure-related models, with a convergence error remaining around 4.5, indicating that traditional sequence models have certain limitations in modeling complex dependencies.

[0061] Figure 4The figure presents the prediction results of the traditional machine learning method SVR (Support Vector Regression), which contrasts sharply with the performance of deep learning models. A significant and widespread discrepancy exists between the SVR prediction curve (dashed line) and the actual value curve (solid line), making it almost impossible to establish an effective fit. SVR predictions exhibit high-frequency and chaotic noise characteristics, with predicted values ​​frequently and erratically fluctuating around the actual values, completely failing to learn the inherent structure and patterns of the data. For example, in the sample point range of 60-70, the actual data shows a relatively stable upward trend, while the SVR prediction shows a series of violent and meaningless oscillations. This clearly demonstrates that traditional models like SVR, which rely on kernel functions and margin maximization, are insufficient in terms of model capacity and expressive power to handle complex time series data such as public transportation travel times, which have highly nonlinear and non-stationary characteristics, rendering their prediction results without practical reference value.

[0062] Figure 5 A thorough cross-sectional comparison of the predictive performance of four different methods (SVR, KNN, LSTM, and the present invention) was conducted to evaluate the robustness of the models under different traffic conditions throughout the day. The horizontal axis of the figure represents six key time periods, covering the complete operating cycle from morning peak to evening off-peak, while the vertical axis represents the mean absolute error (MAE). The following key conclusions can be drawn from this figure: Absolute performance superiority: The green curve representing the "present invention method" is consistently at the bottom of the chart across all time periods, with its MAE value consistently being the lowest among the four methods. This irrefutably demonstrates that the model proposed in this invention possesses the best predictive accuracy and stability across various time scales and traffic contexts. Adaptability to peak traffic periods: The figure clearly reflects the impact of peak traffic periods on prediction difficulty. The errors of all models peak during the evening peak period from 5 PM to 7 PM, which aligns with the objective reality that traffic flow is most complex and uncertain during this time period in the real world. However, even during this most challenging period, the advantages of the method presented in this invention remain significant: its peak MAE is approximately 93 seconds, far lower than LSTM's approximately 110 seconds, KNN's approximately 115 seconds, and SVR's approximately 129 seconds. This indicates that the performance degradation of the method presented in this invention is much smaller than other models when dealing with extreme congestion, demonstrating stronger robustness. Model stability: Compared to other models, especially the highly volatile SVR model, the error curve of the method presented in this invention is flatter, with its MAE value fluctuating within a relatively narrow range (approximately 82 to 93 seconds). This smaller error variance indicates that the model's predictions are more reliable and consistent, less susceptible to the influence of periodic changes in the external traffic environment, demonstrating the model's robustness.

[0063] Example: The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples. The following examples are for illustrative purposes only and are not intended to limit the scope of the invention.

[0064] The experiment used the PyTorch deep learning framework in conjunction with an NVIDIA hardware platform for model training and testing. The hardware configuration included an NVIDIA GeForce RTX 4090 GPU (24GB VRAM), an Intel Core i9-13900K processor, and 64GB of DDR5 memory, providing ample computing resources for large-scale model training.

[0065] The software environment used was PyTorch 2.0.1 framework, coupled with CUDA 11.8 and cuDNN 8.7.0 for GPU acceleration. Model training employed the Adam optimizer with an initial learning rate of 0.001, a batch size of 32, and 200 training epochs. Mean squared error loss was used as the loss function to ensure the model could accurately learn and predict the task. To ensure the reproducibility of experimental results, fixed random seeds were set for all random processes, and PyTorch's deterministic mode was enabled. See Table 2 for details.

[0066] Table 2 Experimental Configuration

[0067] The model training employs a distributed training strategy, improving training efficiency through data parallelism and model parallelism. The training process utilizes mixed-precision training techniques, significantly reducing memory usage and training time while maintaining model accuracy. Experimental setups include strategies such as hyperparameter tuning, cross-validation, and model ensemble to ensure the reliability and reproducibility of experimental results.

[0068] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. In the above embodiments of the present invention, the descriptions of each embodiment have their own emphasis; parts not described in detail in a certain embodiment can be referred to in the relevant descriptions of other embodiments. It should be understood that the disclosed technical content in the several embodiments provided in this application can be implemented in other ways.

[0069] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for predicting bus arrival times based on graph neural networks and a time-frequency hybrid attention mechanism, characterized in that, Includes the following steps: Step 1: Spatiotemporal characteristics analysis and modeling of the journey; Identify the correlation between travel time and frequency domain features, and establish a quantitative impact model; Step 2: Learning travel time features based on time-frequency hybrid attention mechanism. By constructing time-frequency domain feature representation and designing an adaptive attention mechanism, we can model complex travel time relationships. Step 3: Construct a complete prediction system by integrating time-frequency feature fusion, regression network design and training optimization algorithms.

2. The bus arrival time prediction method based on graph neural network and time-frequency hybrid attention mechanism according to claim 1, characterized in that, In step 1, the travel time includes: historical travel time, traffic flow status, and road conditions.

3. A method for predicting bus arrival time based on graph neural networks and a time-frequency hybrid attention mechanism according to claim 1 or 2, characterized in that, Step 1 includes the following steps: Step 11: Correlation analysis between travel time and frequency domain characteristics using Fourier transform and spectral analysis; Step 12: Identify the periodicity of the time series during the identified travel time process; Step 13: Embed time features. Through multi-source data fusion and causal analysis, quantify the influence of various time factors on travel time. The time features include: timestamp, day of the week, holidays, and season.

4. The bus arrival time prediction method based on graph neural network and time-frequency hybrid attention mechanism according to claim 1, characterized in that, In step 11, the correlation analysis between travel time and frequency domain characteristics is achieved through Fourier transform and spectral analysis: ; in, Indicates the first The travel time for each step of the journey. Indicates the first The amplitude of each frequency component Indicates the sequence length.

5. The bus arrival time prediction method based on graph neural network and time-frequency hybrid attention mechanism according to claim 1, characterized in that, In step 12, the process of identifying travel time involves identifying periodic patterns in the time series. Assuming there exists in the travel time series The main cycles, travel time Represented as: ; in, Indicates trend components, Represents periodic components, Indicates noise components; The periodic components are modeled using Fourier series: ; in, Indicates the first The amplitude of each frequency component Indicates frequency, Indicates phase.

6. The bus arrival time prediction method based on graph neural network and time-frequency hybrid attention mechanism according to claim 1, characterized in that, In step 13, the impact of the timestamp is modeled using sine and cosine coding: ; ; in, Indicates location, Representing dimension, Indicates the model dimension.

7. The bus arrival time prediction method based on graph neural network and time-frequency hybrid attention mechanism according to claim 1, characterized in that, In step 2, the frequency domain attention module includes: low-frequency features and high-frequency features, as well as attention; the attention includes: frequency attention, phase attention, and amplitude attention; The low-frequency characteristics represent the main trends and long-term patterns of travel time: ; The high-frequency characteristics represent short-term fluctuations and noise in the travel time: ; The frequency attention refers to the importance of different frequency components to the prediction: ; in, This represents the learnable frequency weight matrix. Represents frequency domain characteristics; The attention weights of the frequency domain attention module are calculated based on the importance and correlation of the frequency components: ; in, and They represent frequencies respectively. and , Represents the frequency correlation function; The output of the frequency domain attention module is represented as follows: ; in, Represents the set of frequencies. Represents frequency Attention weights Represents frequency Its characteristics.

8. The bus arrival time prediction method based on graph neural network and time-frequency hybrid attention mechanism according to claim 1, characterized in that, In step 2, the temporal attention module achieves adaptive temporal feature aggregation by calculating the influence weights of different time steps on the target time step; the calculation process of the temporal attention module includes three steps: feature transformation, attention calculation, and weight normalization. The feature transformation maps different types of time-domain features to the same feature space through a linear transformation: ; in, This represents the learnable weight matrix. Indicates time step The original feature vector; The attention calculation uses an attention function to determine the similarity between time steps. ; in, This represents a learnable attention vector. This represents a vector concatenation operation. This represents the activation function; weight normalization converts the attention scores into normalized weights using the softmax function. ; in, Indicates time step The neighborhood set; Multi-head temporal attention mechanisms enhance the expressive power of a model by computing multiple attention heads in parallel: ; The calculation for each attention head is as follows: ; in, Indicates the first The weight matrix of each attention head. Indicates the first The weight of each attention head; Hybrid attention weight calculation is performed by stacking multiple time-frequency hybrid attention layers to progressively learn time-frequency feature representations from local to global perspectives; the feature update formula for each time-frequency hybrid attention layer is: ; in, Indicates time step In the The feature vector of the layer, Indicates the first Attention weights of layers Indicates the first The weight matrix of the layer, Indicates the activation function; The design of time-frequency hybrid attention follows the principles of residual connections and layer normalization to improve training stability and feature representation ability. ; in It is a layer normalization operation. Indicates the first Time-frequency hybrid attention operation of the layer; The feature extraction process employs a hierarchical aggregation strategy, with different layers learning time-frequency features of different granularities: the first layer learns local time-domain features, capturing travel time patterns between adjacent time steps; the second layer learns medium-range features, capturing daily-cycle-level travel time patterns; and the third layer learns global features, capturing travel time patterns across the entire transportation network. The fusion of these mixed features is achieved through an adaptive weighting mechanism. ; in, Indicates the first The time-frequency fusion weights of the layers are calculated through an attention mechanism: 。 9. The bus arrival time prediction method based on graph neural network and time-frequency hybrid attention mechanism according to claim 1, characterized in that, In step 3, multi-scale feature aggregation is achieved by weighted combination of features from different attention layers. Low-level features capture short-term travel time fluctuations, while high-level features capture long-term traffic pattern changes. Adaptive fusion is achieved through a gating mechanism. ; in, Indicates the first Time-frequency characteristics of the layer Indicates the first Layer fusion weights.

10. The bus arrival time prediction method based on graph neural network and time-frequency hybrid attention mechanism according to claim 9, characterized in that, The gating mechanism is implemented through an attention mechanism, and the softmax function ensures that the sum of the weights of all levels is 1. ; in, It represents the global time-frequency characteristics, obtained through global average pooling.