Flight delay prediction model based on graph neural network training and prediction method
By constructing a dynamic graph neural network model with an environment-aware metagraph learner and a physical constraint time attention module, the problems of insufficient topological evolution and time modeling in flight delay prediction under severe weather conditions in existing technologies are solved, achieving higher accuracy and robustness in delay prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CIVIL AVIATION UNIV OF CHINA
- Filing Date
- 2026-07-02
- Publication Date
- 2026-08-04
AI Technical Summary
Existing flight delay prediction technologies based on graph neural networks cannot respond in real time to the topological evolution caused by meteorological conditions under severe weather conditions, and the time modeling lacks physical operational constraints, resulting in insufficient prediction accuracy and robustness.
An environmental perception metagraph learner is constructed to generate a dynamic spatial transition matrix using real-time meteorological covariates. Combined with a physical constraint time attention module, the time attention is forced to follow the flight time pattern, forming a dynamic graph neural network model.
It improves the spatial modeling accuracy of the model under non-stationary weather conditions, reduces error accumulation in long-term forecasts, and enhances the accuracy and stability of forecasts.
Smart Images

Figure CN122509268A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of graph neural networks and spatiotemporal prediction technology, and in particular to a training and prediction method for a flight delay prediction model based on graph neural networks. Background Technology
[0002] Flight delay prediction is a key technical challenge in air traffic flow management. Accurate network-wide delay prediction can effectively suppress the cascading propagation of delays within the network, preventing local disturbances from rapidly spreading to the entire network, thereby improving the operational efficiency of the aviation network. In recent years, spatiotemporal prediction methods based on Graph Neural Networks (GNNs) have become the mainstream technical approach. These methods construct an aviation network graph structure, utilize graph convolution or graph attention mechanisms to capture the spatial dependencies between airport nodes, and combine recurrent neural networks, temporal attention mechanisms, and other modules to model the temporal evolution of delays.
[0003] In existing technologies, typical solutions include prediction methods based on static predefined graphs. These methods pre-construct a fixed adjacency matrix based on the geographical distance between airports or the frequency of planned flights, and then train a graph neural network on this static graph. While these methods are effective under normal operating conditions, the non-stationarity of aviation networks means that their underlying topology dynamically changes with weather conditions. Severe weather events such as thunderstorms and typhoons can temporarily block specific routes, forcing flights to detour or be canceled, thus substantially altering the spatial dependencies of delay propagation. Static graph neural network models cannot perceive this weather-driven topology reconstruction, leading to a significant decrease in prediction accuracy under severe weather conditions.
[0004] To address the dynamic nature of networks, some improvements have introduced dynamic graph update mechanisms, such as utilizing learnable graph parameters or dynamic graph generation modules based on input features. However, existing dynamic graph methods typically rely on statistical correlations in historical data to update adjacency relationships, lacking explicit modeling of external environmental factors (especially meteorological information). In other words, changes in graph structure are still driven purely by data, rather than directly guided by interpretable environmental variables. When encountering out-of-distribution extreme weather events, the lack of corresponding graph structure patterns in the training data makes it difficult for dynamic graph neural networks to generalize to unseen topological evolutions.
[0005] In modeling time dependencies, existing methods generally employ purely data-driven attention mechanisms or recurrent neural networks. These models predict future delays by learning temporal correlations in historical sequences. However, such techniques suffer from a lack of physical constraints: the models are prone to overfitting to accidental delay spikes in historical data, misclassifying delay correlations between two airports with no physical propagation possibility as causal dependencies. For example, standard time attention mechanisms may ignore the actual time windows required for flights to travel between airports, incorrectly encoding non-causal temporal coincidences as delay propagation paths. This lack of physical operational constraints leads to uncontrollable error amplification in multi-step predictions.
[0006] In summary, existing graph neural network-based flight delay prediction technologies face two major limitations: the spatial graph structure cannot respond in real time to topological evolution caused by meteorological conditions; and the temporal modeling lacks physical constraints, making it prone to fitting spurious time dependencies. Therefore, there is an urgent need for a method to train graph neural network models that integrates adaptive environmental perception with physical causal constraints, in order to improve the prediction accuracy and robustness of the trained models under complex meteorological conditions. Summary of the Invention
[0007] To address the aforementioned technical problems, the technical solution adopted by this invention is as follows:
[0008] According to a first aspect of the present invention, a training method for a flight delay prediction model based on a graph neural network is provided, the method comprising the following steps:
[0009] Acquire training samples, each training sample including: historical delay time series data of multiple airports within a historical time window, real-time meteorological covariates corresponding to the historical time window, and future delay data as a monitoring signal.
[0010] An environment-aware metagraph learner is constructed. The environment-aware metagraph learner adopts a hypernetwork structure and takes the real-time meteorological covariates as input to generate a dynamic spatial transition matrix. The dynamic spatial transition matrix is used to characterize the real-time changes in the spatial dependence between airports driven by meteorological conditions.
[0011] A physical constraint time attention module is constructed. The physical constraint time attention module generates a physical causal mask based on the flight time between airports in the flight plan, and applies the physical causal mask to the time self-attention calculation to obtain the time adjacency matrix. The physical causal mask forces the time attention to only focus on historical time steps that conform to the laws of physical propagation.
[0012] The historical delay time series data, the dynamic spatial transition matrix, and the temporal adjacency matrix are input into a graph neural network for spatiotemporal feature propagation to obtain predicted delay data.
[0013] The difference between the predicted delay data and the supervision signal is calculated, and the network parameters of the graph neural network are updated based on the difference.
[0014] According to a second aspect of the present invention, a flight delay prediction method based on graph neural networks is provided, comprising:
[0015] Obtain a trained graph neural network model, which is trained by the method described in the first aspect.
[0016] Obtain historical delay time series data and real-time meteorological covariates for multiple airports at the time to be predicted.
[0017] The historical delay time series data and real-time meteorological covariates are input into the trained graph neural network model to obtain the delay prediction results for future time periods.
[0018] The training method for a flight delay prediction model based on graph neural networks provided in this invention constructs an environment-aware metagraph learner, mapping real-time meteorological covariates into a dynamic spatial transition matrix. This enables the graph neural network to adjust the spatial dependencies between airports in real time according to weather changes. Compared to static graph structures, this method can adjust the topological connectivity of the dynamic spatial transition matrix when severe weather such as thunderstorms and typhoons obstruct flight routes, thereby improving the spatial modeling accuracy under non-stationary weather conditions. Furthermore, by constructing a physically constrained time attention module, a physical causal mask based on planned flight time is used to force time attention to focus only on historical time steps that conform to propagation laws, avoiding overfitting of purely data-driven models to spurious long-distance temporal correlations. This mechanism ensures that the aggregation of information in the time dimension strictly follows the causal laws of flight operations, reducing error accumulation in long-term predictions.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A flowchart illustrating the training method for a flight delay prediction model based on a graph neural network, as provided in an embodiment of the present invention. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 are within the scope of protection of the present invention.
[0023] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0024] It should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. A process can be terminated when its operation is complete, but it may also have additional steps not included in the figures. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0025] Example 1
[0026] This invention provides a training method for a flight delay prediction model based on graph neural networks. This method utilizes historical departure delay data, historical arrival delay data, and external factors such as weather to predict departure and arrival delays within a future long-term window.
[0027] The overall architecture of the flight delay prediction model based on graph neural networks provided in this embodiment follows the Spatio-Temporal Network (ST) architecture, and consists of the following core modules cascaded together:
[0028] An environmental perception metagraph learner is used to generate a dynamic spatial transition matrix through hypernetwork mapping, taking real-time meteorological covariates as input, to characterize the real-time changes in the spatial dependence between airports driven by meteorological conditions.
[0029] The physical constraint time attention module is used to generate a physical causal mask based on the inter-airport flight time in the flight plan, and apply the physical causal mask to the time self-attention calculation to obtain the time adjacency matrix, which forces the time attention to only focus on historical time steps that conform to the physical propagation law.
[0030] The spatiotemporal feature propagation layer is used to receive historical delay time series data, the dynamic spatial transition matrix and the temporal adjacency matrix, perform tensor modular multiplication operations along the spatial, temporal and feature dimensions, and output predicted delay features.
[0031] The squeeze-excitation module is used to perform channel recalibration on the output features of the spatiotemporal feature propagation layer.
[0032] The output layer is used to map the recalibrated features to predicted arrival / departure delays for future time periods.
[0033] Based on the above architecture, such as Figure 1 As shown, the training method specifically includes the following steps:
[0034] S100, obtain training samples.
[0035] Each training sample includes: historical delay time series data for multiple airports within a historical time window, real-time meteorological covariates corresponding to the historical time window, and future delay data as a monitoring signal.
[0036] This embodiment divides the running time into time windows with preset time intervals (e.g., 30 minutes), with each time window representing a time step. The historical time window contains Tin consecutive time steps, and the future prediction window contains Tout consecutive time steps. In one specific implementation, Tin is set to 12 (i.e., 6 hours of historical data), and Tout is set to 12 (i.e., predicting the next 6 hours), but the invention is obviously not limited to this and can be adjusted according to actual needs.
[0037] To model the propagation of delays between airports, the aviation network is represented as a multi-relationship graph, where nodes represent airports and edges represent flight connections between airports. Let the total number of airports be N, and the historical delay tensor be denoted as X∈R. (N ×Tin×C) Where C is the delay feature dimension, and R represents the real number field. Specifically, C includes at least two features: average arrival delay and average departure delay. Each element in X records the average arrival delay value and average departure delay value of the corresponding airport at each time step within the time window of the preset time length.
[0038] Average arrival delay refers to the average delay, in minutes, of all flights arriving at the airport relative to their scheduled arrival time within the preset time window (e.g., 30 minutes). If no flights arrive within the time window, this value is zero. Average departure delay refers to the average delay, in minutes, of all flights departing from the airport relative to their scheduled departure time within the preset time window (e.g., 30 minutes). If no flights depart within the time window, this value is zero.
[0039] In this article, flight connectivity refers to the existence of scheduled or unscheduled air routes between two airports, i.e., flight services planned by airlines from one airport to another. Specifically:
[0040] If there is at least one planned flight that flies directly from airport A to airport B (including cases where the flight number remains the same but with a stopover), then airport A and airport B are considered to have a flight connection relationship, which corresponds to a directed edge in the graph model.
[0041] Flight connectivity can be determined based on flight schedules or historical operational data, and typically includes two aspects: physical accessibility (having a route) and actual operation (having scheduled flights).
[0042] The flight connections are used to construct the basic topology of the graph. Subsequent models will further adjust the dependency strength between nodes based on this topology using a dynamic spatial transition matrix.
[0043] Unlike existing technologies that use static weather categories, this embodiment introduces real-time, continuous meteorological covariates as external environment inputs. These meteorological covariates include specific meteorological state parameters, such as visibility, wind speed, temperature, precipitation, and features after numerical encoding of weather phenomena such as fog, rain, snow, and thunderstorms. The encoding method employs one-hot encoding or label encoding, commonly used in this field. Let the meteorological feature dimension be D (this dimension may include parameters such as temperature, visibility, precipitation, wind speed, and weather type encoding), then the real-time meteorological covariates are represented as tensors Zt∈R. (N×D) Each element in the meteorological covariate tensor corresponds to the instantaneous meteorological observation of a specific airport at time t (usually the end of a historical time window).
[0044] For each training sample, the supervision signal is the actual delay data for a future time period, denoted as Y. pred ∈R (N ×Tout×C) Similar to the historical delay tensor, Y pred Each element in the table represents the average arrival delay and average departure delay for the corresponding airport within a preset time window (e.g., 30 minutes). The goal of this step is to learn a mapping function f that takes the historical delay sequence and the meteorological covariate at the current time t as input and outputs the predicted future delay value.
[0045] The time interval of the historical delay sequence is from time t-Tin+1 to time t, with each time step separated by the preset time length; the time interval of the future delay prediction value covers from time t+1 to t+Tout.
[0046] Specifically, the time-continuous historical delay tensor X t-Tin+1:t The meteorological covariate tensor Zt at time t is input together with the mapping function f to obtain the delay tensor Y for the next Tout time steps to be predicted. t+1:t+Tout .
[0047] During actual data collection, due to differences in the completeness of reports from different airports, delay data for some airports may be missing at certain time steps. To maintain tensor alignment, missing data is padded with zero values, and a masking mechanism is used during training (see subsequent steps) to eliminate the interference of these padded zero values on model parameter updates. Meteorological covariates are obtained through real-time data collection from airport meteorological stations or numerical weather prediction systems to ensure strict temporal alignment with the delay data.
[0048] By performing the above S100 step, multiple training samples can be obtained. Each sample contains historical delay sequences, real-time meteorological covariates, and corresponding future delay ground truth values, which are used for supervised training of the subsequent model.
[0049] S200, constructing an environment-aware metagraph learner.
[0050] In traditional graph-based flight delay prediction models, the spatial adjacency matrix is typically treated as a set of static parameters directly optimized during training, lacking adaptability to changes in the external environment. To overcome this limitation, this embodiment constructs an Environment-aware Meta Graph Learner (EMGL). This learner employs a hypernetwork structure, using real-time meteorological covariates as meta-knowledge to dynamically generate a transition matrix reflecting spatial dependencies driven by meteorological conditions. Furthermore, this learner incorporates a gating mechanism to adaptively increase or decrease the weights corresponding to static physical connections based on the real-time meteorological context, ultimately generating a dynamic spatial transition matrix.
[0051] The environment-aware metagraph learner constructed in this step includes the following substructures:
[0052] Meta-spatial projection layer: used to map real-time meteorological covariates into meteorological meta-knowledge;
[0053] Static physical prior fusion layer: Explicitly adjust the preset static physical priors (such as fixed connections based on geographical distance) using extracted meteorological metadata.
[0054] Gated regulation network: composed of multiple fully connected layers stacked together, used to generate regulation factor matrix;
[0055] Dynamic graph generation layer: used to multiply the static physical priors element by element with the adjustment factor matrix to output the dynamic space transition matrix.
[0056] The specific calculation process of this learner is as follows:
[0057] S201 uses the meta-spatial projection layer to perform meta-spatial projection and meteorological meta-knowledge extraction.
[0058] First, the real-time meteorological covariate tensor Zt is mapped to the latent metaspace through a learnable linear transformation or neural network layer (i.e., projection function φ) to obtain the latent meta-representation H. meta ∈R N×dmeta This process can be represented as: H meta =φ(Zt;θ proj ).
[0059] Where φ is the projection function, such as a fully connected layer or a convolutional layer; θ proj H represents the set of all trainable parameters in φ, specifically including the weight matrix (learnable coefficients in the linear transformation) and the bias vector (optional learnable bias terms, if the projection layer contains biases). meta Each row in the table corresponds to the meteorological metadata of an airport under the current weather conditions, which is used to guide subsequent topology generation. dmeta represents the dimension of the latent metaspace, which is a pre-defined hyperparameter (such as 16, 32, or 64) and represents the length of the vector after the high-dimensional meteorological features are compressed and encoded.
[0060] S202, using the static physical prior fusion layer to obtain the static physical prior matrix.
[0061] In this embodiment, a static physical prior matrix A is predefined. static ∈R N×N This prior matrix reflects the baseline spatial dependence strength between airports in the absence of weather interference, and its specific construction method is as follows (but not limited to this):
[0062] Method 1: Based on geographical distance
[0063] The elements of the constructed matrix are: A static (ij) = exp(-(dist) ij ) 2 / 2σ 2 ), where A static (ij) is A static The element in the i-th row and j-th column of the array represents the static adjacency weight between airports i and j. This weight is a non-negative value; the closer the distance, the closer the weight is to 1, and the farther the distance, the closer the weight is to 0. ijLet represent the spatial distance between airports i and j, typically expressed as spherical distance in kilometers. `exp()` represents the exponential function. `σ` is the Gaussian kernel bandwidth parameter, controlling the decay rate. The values of i and j range from 1 to N. This element represents the strength of the influence of airport j on airport i, determined solely by spatial distance; closer distances result in greater weight.
[0064] Method 2: Based on planned flight frequency
[0065] The elements of the constructed matrix are: A static (ij) = Freq ij / max(Freq), Freq ij To count the number of planned flights from airport i to airport j within a certain period (e.g., one week), `max(Freq)` is the global maximum value of the interaction frequency between all airports. This element represents the flight connectivity strength between airport i and airport j; a higher frequency indicates a closer operational connection and a greater likelihood of delay propagation.
[0066] Method 3: Based on planned flight time
[0067] The elements of the constructed matrix are: A static (ij) = 1 / (τ) ij +ε), where τ ij This represents the planned flight time (in minutes) from airport i to airport j. This value can be obtained from flight schedules or historical operational data, and the unit should be consistent with the time step (e.g., 30 minutes). ε is a small positive number (e.g., 1) to prevent division by zero. This element represents the potential timeliness of the impact of airport j on airport i; the shorter the flight time, the greater the weight, reflecting how quickly delays can propagate from upstream to downstream.
[0068] The three methods described above can be used individually, or multiplied or weighted summed and then normalized to obtain a comprehensive static physical prior matrix. This static prior matrix serves as the basis for subsequent dynamic adjustments and is used by the dynamic graph generation layer.
[0069] S203 uses a gated control network to generate the original control matrix.
[0070] Extracted meteorological metadata H meta Input a gated regulation network and output an original regulation matrix P∈R with the same dimension as the static prior. N×N As a regulation term, it is used to amplify or suppress the connection weights in the static physical prior in real time.
[0071] The specific structure of a gating control network can include multiple fully connected layers, which internally perform layer-by-layer linear mappings. For example, the first layer might connect H... metaThe dimension dmeta is mapped to the hidden layer dimension (e.g., 128), and subsequent layers are gradually transformed until the output dimension matches the dimension N×N of the static physical prior matrix. Nonlinear activation functions (e.g., ReLU) can be interspersed between linear layers. Considering the nonlinear dual moderating effect of weather conditions on flight delay propagation—severe weather may amplify delay propagation due to actions such as hovering in the air and waiting on the ground, or it may disrupt physical connections due to route closures and flight cancellations—this embodiment uses the hyperbolic tangent (Tanh) activation function in the last layer of the gating control network to compress the output value to the range [-1, 1], thus obtaining the original control matrix P. Each element in this matrix takes a value in [-1, 1], representing either suppression (negative value) or enhancement (positive value) of the static physical connection weights.
[0072] S204, combined with the gating mechanism, generates the scaling factor matrix.
[0073] The final scaling factor matrix Λ is generated by combining a gating mechanism λ. λ can be a learnable scalar parameter, or a gating coefficient vector between 0 and 1 generated by the sigmoid function. Specifically: Λ = 1 + λ⊙P.
[0074] Here, ⊙ represents the Hadamard product (element-wise multiplication). Since the elements in P range from [-1,1], and λ∈[0,1] (when using Sigmoid gating), each element of Λ is strictly limited to the range [0,2]. This scaling factor matrix determines the magnitude of the adjustment to the static prior: when Λ is greater than 1, the corresponding static connection is strengthened; when Λ is less than 1, the corresponding static connection is weakened; when Λ equals 0, it is equivalent to completely blocking the connection.
[0075] S205 uses a dynamic graph generation layer to generate a dynamic spatial transition matrix.
[0076] The static physical prior matrix A static Multiplying element-wise by the scaling factor matrix Λ yields the dynamic space transition matrix:
[0077] A t meta =Astatic⊙Λ.
[0078] Among them, A t meta Let A represent the dynamic space transition matrix generated by the meta-learner at the current time t, which is a dynamic matrix that changes with the time step. The resulting dynamic space transition matrix A... t meta ∈R N×N It can characterize the spatial dependencies between airports under current meteorological conditions in real time. This dynamic spatial transition matrix will be used by subsequent spatiotemporal feature propagation layers, replacing the fixed graph structure in traditional models.
[0079] Through the above steps, the construction and operation mechanism of the environmental perception metagraph learner were completed. This learner enables the graph neural network to adaptively adjust the spatial topology according to the real-time meteorological environment, effectively responding to weather-driven structural evolution.
[0080] S300, constructing a physical constraint time attention module.
[0081] Purely data-driven time attention mechanisms are prone to overfitting spurious long-distance temporal correlations in historical data (e.g., coincidental delay peaks between two distant airports) when modeling flight delay propagation, leading to non-causal prediction errors. To address this issue, this embodiment constructs a physically constrained time attention module. This module generates a physical causality mask based on inter-airport flight times in the flight schedule and applies this mask to the time self-attention calculation, forcing the model to focus only on historical time steps that conform to the physical propagation laws, ultimately obtaining a physically constrained time adjacency matrix.
[0082] The physically constrained temporal attention module constructed in this step includes the following substructures connected in sequence:
[0083] Flight time encoder: used to obtain planned flight times between airports;
[0084] Physical causal mask generator: used to generate a mask (0 or -∞) based on the degree of matching between the time difference and the flight time.
[0085] Mask injection attention layer: used to add a mask to the original attention score and perform the normalized exponential function Softmax operation.
[0086] The specific calculation process of this physically constrained time attention module is as follows:
[0087] S301 uses a time-of-flight encoder to obtain the planned flight time between airports.
[0088] Based on the flight schedule, obtain the planned flight time τ between any two airports. ij For airport pairs without direct flights, the planned flight time can be considered infinite, and the corresponding position in subsequent mask generation is always set to -∞. These flight times serve as prior physical knowledge to constrain the aggregation of information in the time dimension.
[0089] S302, constructs a physical causal mask using a physical causal mask generator.
[0090] In the time-based self-attention calculation process, for a given airport pair (i, j) (i.e., the delay propagation relationship between airport i and airport j), the model needs to determine whether the delay status at historical time t′ can affect the prediction at the current time t. According to the laws of physical propagation, it takes at least τ for a delay to propagate from upstream airport j to downstream airport i. ij The time tolerance threshold δ is set as an operational buffer, taking into account the common uncertainties in actual flight operations (such as taxiing time fluctuations, air traffic control delays, etc.).
[0091] For each historical moment t′, calculate the time lag Δt = (tt′). Define the physical causality mask M. phys The element selection rules for (its dimension is the same as the attention score matrix) are as follows:
[0092] When |Δt-τ ij When |≤δ, the mask value is 0, indicating that there is a time relationship between the historical moment and the current moment that conforms to the laws of physical propagation, and the corresponding attention score should be retained.
[0093] Otherwise, that is, when |Δt-τ ij When |>δ, the mask value is -∞, indicating that there is no effective physical propagation path between the historical moment and the current moment. The corresponding position should be masked in the attention score calculation (i.e. the weight approaches 0 after the normalized exponential function Softmax operation).
[0094] In this embodiment, the operational buffer is set to three time steps, each lasting 30 minutes, allowing for a deviation of ±90 minutes to accommodate typical flight operation uncertainties. The mask is dynamically generated based on the airport pair (i,j) and the time step (t,t′), and the physical mask pattern differs for different spatial connections.
[0095] S303 utilizes masked injection of attention layer to inject time-based self-attention computation.
[0096] First, let's briefly explain the basic structure of the temporal self-attention layer used in this module. Let the input time series features be H∈R. Tin×d (Where d is the feature dimension). The self-attention layer first uses three learnable linear transformation matrices W. Q W K W V The input sequence is mapped to a query matrix Q, a key matrix K, and a value matrix V, respectively: Q = HW Q K=HW K V=HW V .
[0097] Then, the attention score matrix QK is calculated. T / (dk ) 1 / 2 , where d k The dimension of the query vector or key vector, used for scaling to prevent the dot product from becoming too large.
[0098] In standard self-attention mechanisms, the attention score is typically calculated by multiplying the query matrix Q and the key matrix K, and then normalized using Softmax. The improvement in this module lies in: before the Softmax operation, the physical causal mask M is applied. phys The element-wise addition is applied to the original attention score. Specifically, for the g-th spatiotemporal feature propagation layer, there are H attention heads. For example, H=4. For the h-th attention head, its physical constraint temporal adjacency matrix A T (g,h) Calculated using the following formula:
[0099] A T (g,h) =Softmax(Q h K h T / (d k ) 1 / 2 +M phys ).
[0100] Where g ranges from 1 to G, where G is the total number of spatiotemporal feature propagation layers, h ranges from 1 to H, where H is the total number of attention heads, and Q... h and K h T These are the query matrix and key matrix for the h-th attention head, respectively. Finally, the final temporal adjacency matrix A of the g-th spatiotemporal feature propagation layer... T (g) The result can be obtained by concatenating the outputs of H heads and then performing a linear transformation, for example, by concatenating along the last dimension and then performing a linear transformation, or by taking the average of the outputs of each head. This fused matrix is used for the spatiotemporal feature propagation of this layer.
[0101] Due to M phys For positions containing -∞, the weights of these positions become 0 after Softmax calculation, effectively shielding historical time steps that do not conform to the laws of physical propagation. This operation ensures that information aggregation strictly follows the temporal causality of flight operations, prohibiting the model from focusing on past moments that are physically impossible to influence the current delay.
[0102] S304, Output the time adjacency matrix
[0103] After the above steps, the spatial dimension of the temporal adjacency matrix under physical constraints is finally obtained as R. Tin×Tin(Or, depending on the specific implementation, extend it to include a spatial dimension). This matrix reflects the temporal dependencies under strict physical causal constraints and will be used for tensor modular multiplication operations in the temporal dimension in subsequent spatiotemporal feature propagation layers. Compared to purely data-driven temporal attention mechanisms, this module fundamentally suppresses the propagation of spurious delays, significantly reducing error accumulation in long-term predictions.
[0104] S400, the historical delay time series data, the dynamic spatial transition matrix, and the temporal adjacency matrix are input into the graph neural network for spatiotemporal feature propagation to obtain the predicted delay data.
[0105] In this embodiment, the graph neural network is composed of multiple stacked spatiotemporal feature propagation layers. Each layer receives the feature tensor output by the previous layer and uses the dynamic spatial transition matrix and the temporal adjacency matrix to perform decoupled tensor modular multiplication operations along the spatial, temporal, and feature dimensions, ultimately outputting the predicted delay data. The specific calculation process is as follows:
[0106] The spatiotemporal feature propagation is achieved by performing tensor modular multiplication operations on the historical delay time series data. These tensor modular multiplications are performed along the spatial, temporal, and feature dimensions, respectively. The spatial modular multiplication uses the dynamic spatial transition matrix, and the temporal modular multiplication uses the temporal adjacency matrix. The tensor modular multiplication operation is performed in each layer of the graph neural network. The spatiotemporal feature propagation performs K-step spatial diffusion in each layer of the graph neural network. This K-step spatial diffusion is achieved by summing tensor modular multiplications of powers of the dynamic spatial transition matrix.
[0107] Specifically, let H be the input feature tensor of the g-th spatiotemporal feature propagation layer. g ∈R N×Tin×C This embodiment propagates along the spatial, temporal, and feature dimensions via tensor modular multiplication. For any node, the intermediate output H of the g-th spatiotemporal feature propagation layer... out (g+1) The calculation is as follows:
[0108] .
[0109] in:
[0110] , , These represent the tensor modular multiplication along the spatial, temporal, and feature dimensions, respectively. H represents g In terms of spatial dimension, it is related to (A) t meta ) a Modal product, in the time dimension and with A T(g,h) Modal product and its relationship with W in the feature dimension g a The modal product, i.e., H g The spatial, temporal, and feature dimensions are updated separately, and information aggregation and transformation are performed independently in the three mutually orthogonal dimensions through tensor modular multiplication.
[0111] K is the preset number of spatial diffusion steps. The summation symbol represents the accumulation of the results from diffusion steps 0 to K, achieving K-step spatial diffusion. When a=0, (A t meta ) 0 Defined as an identity matrix, used to preserve the characteristics of the nodes themselves; A t meta a power (A) t meta ) a This represents the dependencies after a-step spatial random walk, used to capture the delayed propagation between multi-hop neighbors;
[0112] A T (g,h) Let h be the temporal adjacency matrix output by the h-th attention head of the g-th spatiotemporal feature propagation layer.
[0113] W g a ∈R Cin×Cout Cin is the learnable feature transformation matrix corresponding to diffusion step a in the g-th spatiotemporal feature propagation layer, used to fuse different feature channels; Cin is the input dimension of the g-th spatiotemporal feature propagation layer, and Cout is the output dimension of the g-th spatiotemporal feature propagation layer.
[0114] σ() is a non-linear activation function, such as ReLU.
[0115] To address the varying importance of multidimensional operational features (such as arrival and departure delay status), a Squeeze-and-Excitation Module (SE module) is introduced after the propagation of each layer of spatiotemporal features. This Squeeze-and-Excitation Module processes the aforementioned intermediate output H. out (g+1) Perform channel recalibration to obtain the output characteristics H of the (g+1)th layer. (g+1) :
[0116] H (g+1) =SE(H out (g+1) ).
[0117] The squeeze-excitation module includes: a global average pooling layer for squeezing the output features of the graph neural network along the spatial dimension to generate channel descriptors; at least one fully connected layer for performing a nonlinear transformation on the channel descriptors to generate channel weight vectors; and a scaling layer for multiplying the channel weight vectors element-wise with each channel of the output features to achieve channel recalibration.
[0118] The SE module is specifically used to perform the following sub-operations:
[0119] Squeezing operation: By global average pooling, H is squeezed along the spatial and temporal dimensions. out (g+1) Perform compression to generate channel descriptors z∈R C The b-th element in z (where b takes values from 1 to C) is calculated as follows:
[0120] Among them, (H) out (g+1) ) ntb This represents the value of the b-th feature channel of airport n at time step t in the intermediate feature tensor after the propagation of the spatiotemporal features of the g-th layer and before recalibration by the SE module.
[0121] Activation operation: The channel descriptor z is sequentially input into the first fully connected layer (output dimension C / f, where f is the reduction ratio, e.g., 16), the ReLU activation function, the second fully connected layer (output dimension C), and finally the channel weight vector s∈R is generated by the Sigmoid activation function. C :
[0122] s=σ sigmoid (W2·δ(W1·z)).
[0123] Where δ() represents the ReLU function, σ sigmoid () represents the Sigmoid function, and W1 and W2 are the learnable weight matrices of the two fully connected layers, respectively.
[0124] Scaling operation: sizes the channel weight vector s with the original feature tensor H out (g+1) Each channel is multiplied element-wise to obtain the recalibrated features:
[0125] (H) (g+1) ) ntb =s b · (H) out (g+1) ) ntb s b This represents the weight value corresponding to the b-th channel, used to scale all values of the b-th channel in the original feature tensor. (H) (g+1) )ntb This represents the value of the b-th feature channel of airport n at time step t in the feature tensor output as the g+1-th layer after calibration by the SE module.
[0126] After processing by all G-layer spatiotemporal feature propagation layers and the SE module, the final feature tensor H is... (L+1) The input is passed to an output layer (such as a linear regression layer or a fully connected layer), which maps to the predicted delay value Y within a future time window. pred ∈R N×Tout×C Each element represents the average arrival delay or average departure delay of the corresponding airport within a time window of a preset time length in the future.
[0127] Through the above steps, the graph neural network completes the spatiotemporal feature propagation and mapping from historical delay data, dynamic spatial transition matrix, and temporal adjacency matrix to predicted delay data.
[0128] S500, calculate the difference between the predicted delay data and the supervision signal, and update the network parameters of the graph neural network based on the difference.
[0129] Given the inherent long-tail distribution of flight delay data and the presence of unobserved samples (approximately 16%, filled with zero values) in the dataset, directly applying a standard loss function to the global tensor would force the model to incorrectly fit the meaningless zero values filled to maintain tensor alignment, thus severely weakening generalization ability. Therefore, this embodiment uses Masked Root Mean Square Error (MRMSE) as the optimization objective to train the graph neural network in an end-to-end manner.
[0130] Let the actual delay data (monitoring signal) be Y∈R. N×Tout×C The predicted delay data is Y. pred ∈R N×Tout×C Define a binary indicator mask tensor M∈{0,1} N×Tout×C , where element M n,t,b This indicates whether the position of airport n in the b-th feature channel at time step t is a valid observation data point in the actual delay data. Its value is determined by the following rules:
[0131] If the actual delay value Y at this location n,t,b ≠0, then M n,t,b =1 indicates that the data at this location is valid and should be included in the loss calculation;
[0132] If the actual delay value Y at this location n,t,b =0, then M n,t,b=0 indicates that the data at this location is missing and has zero padding (i.e., there are no valid observation records for this airport at this time step and in this feature channel), and it is not included in the loss calculation.
[0133] The root mean square error loss function L(θ) of the mask is defined as:
[0134] .
[0135] Where θ represents all trainable parameters of the graph neural network, mainly including the following categories (based on the architecture of this embodiment):
[0136] Projection layer parameters: trainable weights and biases in the metaspace projection layer.
[0137] Gated network parameters: weight matrices and biases (i.e., all trainable parameters inside ψ) in multiple fully connected layers.
[0138] Static physical prior matrix: If A static If it is also a learnable parameter (rather than completely fixed), then its elements also belong to the network parameters; in this embodiment, static priors are usually pre-constructed but fine-tuning is not excluded.
[0139] Spatiotemporal feature propagation layer parameters:
[0140] The feature transformation matrix for each diffusion step and each layer.
[0141] The learnable part of the temporal adjacency matrix (such as the Q, K, V linear transformation matrix in the attention mechanism).
[0142] SE module parameters: weight matrices and corresponding biases for the two fully connected layers.
[0143] Output layer parameters: Weights and biases of the linear regression or fully connected layer that map the final features to the predicted values.
[0144] All of the above parameters are jointly optimized using backpropagation and gradient descent.
[0145] The numerator of the mask root mean square error loss function formula calculates the sum of squared errors for all valid positions (mask is 1), and the denominator is the total number of valid positions. Taking the square root yields the root mean square error. This calculation only accumulates errors for the positions corresponding to non-zero true delay values in the monitoring signal, completely ignoring the missing data positions with zero padding.
[0146] By introducing this explicit masking mechanism, the model's gradient updates are strictly driven by the real physical propagation of delays, effectively preventing the optimization process from being contaminated by invalid null data.
[0147] During training, the Adam optimizer is used to update the network parameters θ. Simultaneously, to prevent gradient explosion caused by non-stationary long-tailed data, an explicit gradient pruning mechanism is introduced, setting the maximum gradient norm to 3 (i.e., when the L2 norm of the gradient exceeds 3, it is scaled to this norm). This operation ensures the stability of the training process, and is particularly suitable for time series data with extreme distribution characteristics, such as flight delays.
[0148] In the above manner, step S500 completes the loss calculation and parameter update, realizing end-to-end training of the graph neural network model.
[0149] In this embodiment, the complete training process of the flight delay prediction model based on graph neural networks can be summarized as follows:
[0150] Initialization phase: All trainable parameters θ of the graph neural network are set using a random initialization method (e.g., Xavier initialization or He initialization).
[0151] Iterative training phase: For each batch of training samples, the following steps are executed sequentially: forward propagation (steps S100 to S400) to obtain the predicted delay data; calculate the loss according to the root mean square error of the mask; calculate the gradient of the loss with respect to each parameter through backpropagation; apply gradient clipping (maximum norm 3); and update the parameter θ using the Adam optimizer.
[0152] Validation and Early Stopping Phase: After each training epoch, the loss is calculated on the validation set. If the validation loss does not decrease for a preset number of consecutive epochs (e.g., 10 epochs), early stopping is triggered.
[0153] Termination conditions: Training will be terminated when any of the following conditions are met: (1) the maximum number of epochs is reached (e.g., 200); (2) early cessation is triggered; (3) the training loss drops below a preset threshold (e.g., 0.01).
[0154] Model selection: After training, the model parameters with the minimum validation loss are retained as the final model for subsequent flight delay prediction.
[0155] Example 2
[0156] This embodiment provides a flight delay prediction method based on graph neural networks. This method utilizes the trained graph neural network model obtained in Embodiment 1 to predict future flight delays. Specifically, it includes the following steps:
[0157] S10: Obtain the trained graph neural network model.
[0158] Obtain the graph neural network model trained by the training method described in Example 1. The model includes an environment-aware metagraph learner, a physical constraint time attention module, a spatiotemporal feature propagation layer, a squeeze-excitation module, and an output layer. Its network parameters (including projection layer, gating adjustment network, spatiotemporal feature transformation matrix, SE module weights, output layer weights, etc.) have been determined through training.
[0159] S20: Obtain historical delay time series data and real-time meteorological covariates for multiple airports at the time to be predicted.
[0160] Obtain historical delay time series data for multiple airports within historical time windows prior to the predicted time, along with real-time meteorological covariates corresponding to these historical time windows. Specifically:
[0161] The length of the historical time window is the same as the length of the input sequence Tin during training (e.g., 12 time steps, 30 minutes each). The features of each time step include the average arrival delay and average departure delay of the airport within that time window.
[0162] Real-time meteorological covariates include meteorological observation data of each airport at the time to be predicted (i.e. the end time of the historical time window), such as visibility, wind speed, temperature, precipitation, and codes for weather phenomena such as fog, rain, snow, and thunderstorms. Their dimensions are consistent with the meteorological feature dimension D during training.
[0163] S30: Input the model and perform forward propagation to obtain the prediction results.
[0164] The historical delay time series data and real-time meteorological covariates are input into the trained graph neural network model and processed according to the forward propagation calculation process described in Example 1 (i.e., steps S200 to S400, but without parameter updates):
[0165] The environmental perception metagraph learner dynamically generates a dynamic spatial transition matrix based on real-time meteorological covariates.
[0166] The physical constraint time attention module generates a physical causal mask based on the planned flight time between airports, thus obtaining a time adjacency matrix;
[0167] The spatiotemporal feature propagation layer uses a dynamic spatial transition matrix and a temporal adjacency matrix to propagate spatiotemporal features of historical delay data in multiple steps.
[0168] The squeeze-excitation module recalibrates the feature channels;
[0169] The output layer maps the final features to the delay predictions within a future time window (of length Tout, e.g., 12 time steps).
[0170] S40: Output the delay prediction result.
[0171] The model outputs a three-dimensional tensor Y. pred ∈R N×Tout×C Each element represents the average arrival delay or average departure delay of the corresponding airport within a preset time window in the future, in minutes. This forecast result can be used for downstream tasks such as air traffic flow management and flight scheduling.
[0172] Through the above steps, this embodiment realizes flight delay prediction based on a trained graph neural network model, which can respond to weather changes in real time and strictly follow physical causal constraints, providing accurate long-term delay prediction.
[0173] The flight delay prediction model training method and prediction method based on graph neural networks provided in this application have the following beneficial effects:
[0174] 1. Improved prediction accuracy within long time windows.
[0175] In the time-based self-attention calculation, a physical causal mask based on the planned flight time between airports is introduced, causing the model to focus only on historical time steps that conform to the laws of physical propagation, thus avoiding attention allocation to irrelevant time lags. Experimental results show that, on real aviation datasets, the model described in this application achieves lower mean absolute error (MAE) than existing comparative models at prediction step sizes of 1.5 hours, 3 hours, and 6 hours, reaching the current state of best performance.
[0176] 2. Enhanced forecast stability under severe weather conditions.
[0177] By explicitly encoding real-time meteorological covariates into dynamic spatial transition matrices using an environment-aware metagraph learner, the graph neural network can adjust the spatial dependencies between airports in real time according to weather changes. In out-of-distribution (OOD) extreme weather events (such as thunderstorms and typhoons), the performance degradation of the model described in this application is less than that of models based on static graphs or purely data-driven dynamic graphs, demonstrating stronger environmental adaptability.
[0178] 3. Eliminates the interference of missing data on model training.
[0179] Using the root mean square error of the mask as the loss function, the position of valid observation data is marked by a binary mask tensor. The prediction error is calculated only for non-zero true delay values, completely ignoring the missing zero values filled due to tensor alignment. This mechanism avoids the model parameters being misled by meaningless null values, thus improving the robustness of the learning process.
[0180] 4. It suppresses gradient instability during training.
[0181] To address the long-tail distribution of flight delay data, a gradient clipping threshold (maximum norm of 3) is set during backpropagation, and the Adam optimizer is used for parameter updates. This approach effectively prevents gradient explosion and makes the training process more stable.
[0182] In summary, this application has made significant progress in prediction accuracy, robustness to severe weather, handling of missing data, and training stability, providing reliable technical support for air traffic flow management.
[0183] This invention also provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being configured to perform the method described in this invention.
[0184] This invention also provides a computer-readable storage medium storing computer-executable instructions for performing the methods described in this invention.
[0185] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this invention can be achieved, and this is not limited herein.
[0186] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for training a flight delay prediction model based on a graph neural network, characterized in that, The method includes the following steps: Acquire training samples, each training sample including: historical delay time series data of multiple airports within a historical time window, real-time meteorological covariates corresponding to the historical time window, and future delay data as a supervision signal; An environment-aware metagraph learner is constructed. The environment-aware metagraph learner adopts a hypernetwork structure and takes the real-time meteorological covariates as input to generate a dynamic spatial transition matrix. The dynamic spatial transition matrix is used to characterize the real-time changes of the spatial dependence between airports driven by meteorological conditions. A physical constraint time attention module is constructed. The physical constraint time attention module generates a physical causal mask based on the flight time between airports in the flight plan, and applies the physical causal mask to the time self-attention calculation to obtain a time adjacency matrix. The physical causal mask forces the time attention to only focus on historical time steps that conform to the laws of physical propagation. The historical delay time series data, the dynamic spatial transition matrix, and the temporal adjacency matrix are jointly input into a graph neural network for spatiotemporal feature propagation to obtain predicted delay data. The difference between the predicted delay data and the supervision signal is calculated, and the network parameters of the graph neural network are updated based on the difference.
2. The method of claim 1, wherein, The environmental perception metagraph learner maps the real-time meteorological covariates into a regulation factor matrix through a hypernetwork, and applies the regulation factor matrix to a preset static physical prior matrix to generate the dynamic spatial transition matrix.
3. The method of claim 1, wherein, The physical causal mask is constructed as follows: the planned flight time between any two airports is obtained; during the time self-attention calculation process, the time difference between the current time and the historical time is calculated; when the absolute difference between the time difference and the planned flight time is less than or equal to a preset time tolerance threshold, the corresponding attention score is retained; otherwise, the attention score is masked as negative infinity.
4. The method of claim 1, wherein, The spatiotemporal feature propagation is achieved by performing tensor modular multiplication on the historical delay time series data. The tensor modular multiplication is performed along the spatial dimension, the temporal dimension, and the feature dimension, respectively. The modular multiplication in the spatial dimension uses the dynamic spatial transition matrix, and the modular multiplication in the temporal dimension uses the temporal adjacency matrix. The tensor modular multiplication operation is performed in each layer of the graph neural network.
5. The method of claim 1, wherein, The loss function used to calculate the difference between the predicted delay data and the monitoring signal is the root mean square error of the mask. The root mean square error of the mask is calculated based on the mask tensor, and the prediction error is calculated only for the positions corresponding to the non-zero true delay values in the monitoring signal, while the error is not calculated for the positions corresponding to the missing data with zero padding in the monitoring signal.
6. The method of claim 1, wherein, The environment-aware metagraph learner utilizes the bidirectional properties of the hyperbolic tangent activation function to generate adjustment terms ranging from negative one to positive one, and combines them with a gating mechanism to generate the final dynamic spatial transition matrix, so as to adaptively increase or decrease the weight values corresponding to static physical connections according to the real-time meteorological context.
7. The method of claim 1, wherein, After the spatiotemporal features are propagated, the output features of the graph neural network are recalibrated through the squeeze-excitation module.
8. The method according to claim 7, characterized in that, The squeeze-excitation module includes: a global average pooling layer for squeezing the output features of the graph neural network along the spatial dimension to generate channel descriptors; at least one fully connected layer for performing a nonlinear transformation on the channel descriptors to generate channel weight vectors; and a scaling layer for multiplying the channel weight vectors element-wise with each channel of the output features to achieve channel recalibration.
9. The method according to claim 1, characterized in that, The spatiotemporal feature propagation performs K-step spatial diffusion in each layer of the graph neural network, which is achieved by tensor modular multiplication and summation of powers of the dynamic spatial transition matrix.
10. A method for predicting flight delays based on graph neural networks, characterized in that, include: Obtain a trained graph neural network model, said model being trained by the method of any one of claims 1 to 9; Obtain historical delay time series data and real-time meteorological covariates for multiple airports at the time to be predicted; The historical delay time series data and real-time meteorological covariates are input into the trained graph neural network model to obtain the delay prediction results for future time periods.