Supply chain prediction and early warning method based on space-time diagram neural network

By constructing a supply chain prediction and early warning method based on spatiotemporal graph neural networks, the problem of difficulty in capturing the topology and temporal evolution of supply chain networks in existing technologies is solved, enabling accurate prediction and real-time risk warning of the supply chain, and improving the adaptability and prediction accuracy of the model.

CN122022501APending Publication Date: 2026-05-12FUJIAN POLYTECHNIC OF INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FUJIAN POLYTECHNIC OF INFORMATION TECH
Filing Date
2026-04-13
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing supply chain forecasting methods struggle to simultaneously capture network topology and temporal evolution patterns, neglect the mutual influence between nodes, lack early warning capabilities for potential disruption risks, and suffer from insufficient model adaptability and forecasting accuracy.

Method used

By employing a spatiotemporal graph neural network-based approach, an end-to-end prediction model is constructed through spatial feature extraction, temporal feature extraction, and spatiotemporal feature fusion modules. Combined with a risk warning module and an online incremental learning mechanism, this enables dynamic capture and real-time early warning of the supply chain network.

Benefits of technology

It significantly improves the accuracy of supply chain forecasting and the foresight of early warning, enabling timely identification of potential disruption risks and providing actionable solutions. The model is robust and adaptable, accommodating dynamic changes in the supply chain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122022501A_ABST
    Figure CN122022501A_ABST
Patent Text Reader

Abstract

The invention provides a supply chain prediction and early warning method based on a space-time diagram neural network, and the method comprises the following steps: S1, obtaining multi-source heterogeneous data of a supply chain network, carrying out the data cleaning and alignment, and constructing a supply chain heterogeneous time sequence diagram; s2, constructing and training an end-to-end space-time diagram neural network prediction model; s3, constructing a risk early warning module, calculating node-level and network-level interruption risk indexes based on the predicted value t + H, a preset dynamic threshold value and a risk propagation dynamic model, and generating a graded early warning signal including a risk level, a risk source and a disposal suggestion; s4, inputting supply chain data to the prediction model in real time by adopting a sliding window mode, dynamically updating a prediction result and an early warning signal, and utilizing an online incremental learning mechanism; according to the invention, the dynamic topological structure and the time evolution law of the supply chain network can be captured at the same time, and accurate prediction and real-time risk early warning are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to supply chain forecasting and early warning technologies, specifically, to a supply chain forecasting and early warning method based on spatiotemporal graph neural networks. Background Technology

[0002] Supply chain networks are complex, heterogeneous systems comprised of various entities such as suppliers, manufacturers, distributors, and retailers, with close interdependence among them formed through the flow of materials, capital, and information. With increasing economic globalization and market dynamism, supply chain network structures are becoming increasingly complex, and the risk of disruption is frequent, posing a severe challenge to accurate supply chain forecasting and early warning.

[0003] Existing supply chain forecasting methods are mainly divided into two categories: one is statistical methods based on time series analysis, such as ARIMA and exponential smoothing, which only focus on the historical data changes of a single node and cannot model the mutual influence between nodes in the supply chain network; the other is forecasting methods based on machine learning, such as recurrent neural networks and long short-term memory networks, which can capture time dependence, but treat supply chain nodes as independent individuals and are difficult to characterize the constraints of network topology on node states.

[0004] In recent years, graph neural networks have shown advantages in the field of relationship modeling, but existing solutions still have the following shortcomings: (1) Most methods only consider the network structure and ignore the time characteristics of the dynamic evolution of the supply chain; (2) The fusion mechanism of node features and edge features is simple and difficult to cope with the complexity of heterogeneous supply chain networks; (3) There is a lack of early warning capability for potential interruption risks and the prediction results have failed to be transformed into actionable decision support. Summary of the Invention

[0005] To overcome the above problems, the purpose of this invention is to provide a supply chain prediction and early warning method based on spatiotemporal graph neural networks that can simultaneously capture the dynamic topology and temporal evolution of the supply chain network, thereby achieving accurate prediction and real-time risk warning.

[0006] This invention employs the following scheme: a supply chain prediction and early warning method based on a spatiotemporal graph neural network, comprising the following steps: Step S1, acquiring multi-source heterogeneous data from the supply chain network, performing data cleaning and alignment, and constructing a heterogeneous time series graph of the supply chain; Step S2, constructing and training an end-to-end spatiotemporal graph neural network prediction model, wherein the spatiotemporal graph neural network prediction model includes:

[0007] The spatial feature extraction module employs a relation-aware multi-head graph attention network to assign independent attention mechanisms to different types of node-edge combinations in order to capture high-order structural dependencies and semantic information in the heterogeneous supply chain network.

[0008] The temporal feature extraction module adopts a temporal convolutional network based on a gated dilated causal convolutional network. It expands the receptive field by stacking causal convolutional layers with an exponentially increasing dilation rate, and combines gated linear units to control the flow of temporal information in order to capture the long-term and short-term temporal evolution patterns of the supply chain status.

[0009] The spatiotemporal feature fusion module adopts a multi-head cross-attention mechanism, using spatial features as the query matrix and temporal features as the key and value matrices, to perform deep interactive fusion, and outputs fused features through residual connections and layer normalization.

[0010] The prediction output module passes the fused features through a multi-step predictor composed of fully connected layers to output predicted values ​​of key performance indicators for the supply chain over the next H time steps. _t+H; Step S3: Construct a risk warning module based on the predicted value. The system calculates the interruption risk index at the node and network levels using _t+H, preset dynamic thresholds, and risk propagation dynamics models, and generates a graded early warning signal that includes risk level, risk source, and handling suggestions; Step S4: Input supply chain data into the prediction model in real time using a sliding window method, dynamically update the prediction results and early warning signals, and use an online incremental learning mechanism to fine-tune the model parameters based on newly arrived feedback data.

[0011] Furthermore, the heterogeneous time-series graph of the supply chain in step S1 is defined as G_t = (V, E, X_t, A_t), where V is a set of nodes of various types including suppliers, manufacturers, distributors, and logistics service providers, E is a set of edges representing the transaction, transportation, or information transmission relationships between nodes, X_t ∈ R^(N×F) is the F-dimensional feature matrix of all N nodes at time t, and A_t ∈ R^(N×N) is the weighted adjacency matrix at time t, whose element values ​​are dynamically calculated based on transaction frequency, transportation duration, or cooperation strength.

[0012] Furthermore, the spatial feature extraction module in step S2 specifically includes: a type mapping layer, used to project node features and edge features of different categories onto a unified semantic space through a specific type of learnable linear transformation; and a relation-aware attention layer, which independently calculates the attention coefficients between node i and its neighbor j for each meta-path or relation type r: e_{ij}^r = LeakyReLU( (a^r)^T [ W_{src}^{τ(i)} h_i || W_{dst}^{τ(j)} h_j || W_{edge}^r e_{ij} ] ), where τ(·) represents the node type, h_i is the hidden state of node i, W is the learnable weight matrix of the corresponding type or relation, a^r is the attention parameter vector of relation r, e_{ij} is the edge feature, and || represents the concatenation operation; Normalization and aggregation layer, within each relation, the attention coefficient e_{ij}^r is normalized using the softmax function to obtain α_{ij}^r, and based on this, the transformation features of the neighbors are weighted and summed to obtain the relation-specific node representation h_i^{r'} = σ( Σ_{j∈N_i^r} α_{ij}^r W_{dst}^{τ(j)} h_j ); Semantic fusion layer, using an attention mechanism or gating network, adaptively fuses the representations {h_i^{r'}} learned by node i under different relations to obtain the final spatial feature representation h_i^{spatial}.

[0013] Furthermore, the temporal feature extraction module in step S2 specifically includes: a sequence embedding layer, which performs channel transformation on the input node feature sequence X ∈ R^(N×T×F) through 1x1 convolution and adds learnable positional encoding to preserve temporal order information; a gated dilated causal convolutional layer, which consists of L stacked residual blocks, each residual block containing two parallel dilated causal convolution operations: one for outputting the main feature and the other as a gate; assuming the input of the l-th layer is z^{l-1} and the dilation factor is d_l, then the output z^l of this layer is calculated as: z^l = (z^{l-1} * W_f^l + b_f^l) σ(z^{l-1} * W_g^l + b_g^l) + z^{l-1}, where * denotes a causal convolution with an inflation factor of d_l, and W_f and W_g are the kernel weights. For element-wise multiplication, The sigmoid activation function is used; the output layer passes the output of the last residual block through a fully connected layer or a global average pooling layer to obtain the compressed temporal feature representation h_i^{temporal}.

[0014] Furthermore, the spatiotemporal feature fusion module in step S2 specifically includes: a multi-head cross-attention layer, which maps spatial features H_s to a query matrix Q = H_s W_Q, and temporal features H_t to a key matrix K = H_t W_K and a value matrix V = H_t W_V, and calculates the cross-attention output: Head_i = Attention(Q_i, K_i, V_i) = softmax( (Q_i K_i^T) / √d_k ) V_i, where d_k is the dimension of the key vector. Then, the outputs of multiple heads are concatenated and linearly transformed to obtain the cross-attention features; an adaptive gated fusion layer, which calculates the fusion weight g = σ( [H_s || H_t] W_g + b_g ), and finally fuses the feature H_f = g ⊙H_cross + (1-g) ⊙(H_s + H_t), where H_cross is the cross-attention feature and ⊙ is the element-wise multiplication; the feedforward network layer inputs the fusion feature H_f into a two-layer fully connected network, accompanied by residual connections and layer normalization, and outputs the final spatiotemporal fusion representation.

[0015] Furthermore, the risk warning module in step S3 specifically includes: a dynamic threshold generation submodule, which dynamically updates the upper and lower limits of the warning thresholds θ_i^u(t) and θ_i^l(t) for each node and each indicator based on historical prediction residuals and real-time data streams using an exponentially weighted moving average method; and a node risk index calculation submodule, which calculates the node risk index based on the predicted values. The risk propagation and tracing submodule calculates the comprehensive risk index r_i(t) = f(deviation, duration) of node i at time t by considering the degree of deviation between _i(t) and the dynamic threshold, as well as the duration of the deviation. The risk propagation and tracing submodule constructs a directed weighted risk propagation graph with node weights r_i(t) and edge weights representing the mutual influence coefficients between supply chain nodes. It simulates the propagation path and impact range of risk in the network using graph convolutional networks or random walk algorithms, and traces back to the most likely "risk source" node. The early warning level generation submodule maps the calculated network-level risk index R(t) and the identified risk source information to four levels: "attention, prompt, warning, and alarm," and generates decision suggestions containing specific handling steps based on a preset rule base.

[0016] Furthermore, the online incremental learning mechanism in step S4 specifically includes the following steps:

[0017] Step S41: Real-time data stream processing and sample construction. The system continuously receives real-time data streams from multiple sources. After the same data cleaning and feature engineering process as in step S1, the node feature matrix X_t and adjacency matrix A_t are formed at the current time t.

[0018] Step S42: Prediction and Early Warning Service. Input the current sliding window data into the deployed spatiotemporal graph neural network prediction model to obtain the predicted value for the next H steps. _{t+1:t+H}, and the risk warning module generates real-time warning signals;

[0019] Step S43: Update the trigger condition judgment, including timed triggers and performance triggers;

[0020] Step S44: Online incremental update algorithm;

[0021] Step S45: Model version management and rollback. After each incremental update, a new model version is generated and its performance metrics are recorded. If the performance of the new version on the validation set drops significantly, the system automatically rolls back to the previous stable version and triggers an alarm, prompting manual intervention to check the data or update the strategy.

[0022] Furthermore, step S41 is further specified as follows: using a sliding window of length T, the latest T time step data {X_{t-T+1}, ..., X_t} and the corresponding future H step true labels Y_{t+1:t+H} are combined to form an online training sample (X_{t-T+1:t}, A_{t-T+1:t}, Y_{t+1:t+H}), and stored in the experience replay pool D; the experience replay pool adopts a first-in-first-out strategy and has a fixed capacity of M to ensure that the most recent representative samples are stored.

[0023] Furthermore, step S44 is further specified as follows: when the triggering condition is met, the following incremental learning process is executed:

[0024] Sampling: Randomly sample a sample set D_batch of batch size B from the experience replay pool D; the sampling strategy takes into account both recent samples and historically representative samples, for example, prioritizing experience replay and assigning higher sampling weights based on the prediction error of the samples;

[0025] Calculating the joint loss: The loss function consists of two weighted parts:

[0026] New data fitting loss: Calculate model predictions on D_batch The Huber loss L_new, compared to the true value Y, ensures that the model fits the new data distribution.

[0027] Knowledge distillation loss: To preserve old knowledge, distillation loss is introduced; the output of the current student model on old samples is approximated to the output of the teacher model before the update; specifically, in the sampling batch, the prediction of the teacher model is calculated simultaneously. _teacher, then calculate student model predictions The mean squared error or KL divergence between _student and teacher predictions is used as the distillation loss L_distill; the total loss is L = L_new + λ * L_distill, where λ is the balance coefficient, which can be dynamically adjusted according to the amount of new data and the importance of old knowledge.

[0028] Gradient calculation and parameter update: Using the Adam optimizer, the gradient is calculated based on the total loss L, and the model parameters θ are updated by one or more steps of gradient descent.

[0029] Soft update of teacher model: To prevent the teacher model from becoming outdated, the teacher model parameters are updated every certain number of steps using the exponential moving average method: θ_teacher = α * θ_teacher + (1-α) * θ_student, where α is a decay factor close to 1.

[0030] The beneficial effects of this invention are as follows: Significantly improved prediction accuracy: "Relationship-aware graph attention" accurately captures the complex dependencies of heterogeneous supply chains; "gated dilated causal convolution" efficiently captures long- and short-term temporal patterns; and "cross-attention" deeply integrates spatiotemporal features. These three technological innovations work together to significantly outperform methods using only time series data or ordinary graph neural networks. More forward-looking and actionable early warnings: It not only warns of "what will happen," but also answers "why it will happen" and "where it will affect" through risk tracing and deduction. The introduction of dynamic thresholds improves the accuracy of early warnings, and combined with rule-based suggestions, early warnings are no longer isolated information silos but rather the starting point for decision-making. Enhanced model robustness and adaptability: Adversarial training is introduced during the training phase to enhance the model's resistance to noisy data. The deployment phase employs online incremental learning, enabling the model to smoothly adapt to long-term changes in the supply chain and market trends, avoiding the drawbacks of rapid model aging and frequent offline retraining. The system is fully functional and highly practical: This invention not only proposes an algorithm model but also designs a complete system architecture from data access, model prediction, risk assessment to visual interaction and model operation and maintenance, providing a clear path for the application of the technology in real-world complex supply chain environments. Attached Figure Description

[0031] Figure 1 This is a schematic diagram of the method flow of the present invention.

[0032] Figure 2 This is a system principle block diagram of the present invention. Detailed Implementation

[0033] The invention will now be further described with reference to the accompanying drawings.

[0034] Please see Figure 1As shown, the present invention provides a supply chain prediction and early warning method based on a spatiotemporal graph neural network, comprising the following steps: Step S1, acquiring multi-source heterogeneous data from the supply chain network, performing data cleaning and alignment, and constructing a heterogeneous time series graph of the supply chain; Step S2, constructing and training an end-to-end spatiotemporal graph neural network prediction model, wherein the spatiotemporal graph neural network prediction model includes:

[0035] The spatial feature extraction module employs a relation-aware multi-head graph attention network to assign independent attention mechanisms to different types of node-edge combinations in order to capture high-order structural dependencies and semantic information in the heterogeneous supply chain network.

[0036] The temporal feature extraction module adopts a temporal convolutional network based on a gated dilated causal convolutional network. It expands the receptive field by stacking causal convolutional layers with an exponentially increasing dilation rate, and combines gated linear units to control the flow of temporal information in order to capture the long-term and short-term temporal evolution patterns of the supply chain status.

[0037] The spatiotemporal feature fusion module adopts a multi-head cross-attention mechanism, using spatial features as the query matrix and temporal features as the key and value matrices, to perform deep interactive fusion, and outputs fused features through residual connections and layer normalization.

[0038] The prediction output module passes the fused features through a multi-step predictor composed of fully connected layers to output predicted values ​​of key performance indicators for the supply chain over the next H time steps. _t+H; Step S3: Construct a risk warning module based on the predicted value. The system calculates the interruption risk index at the node and network levels using _t+H, preset dynamic thresholds, and risk propagation dynamics models, and generates a graded early warning signal that includes risk level, risk source, and handling suggestions; Step S4: Input supply chain data into the prediction model in real time using a sliding window method, dynamically update the prediction results and early warning signals, and use an online incremental learning mechanism to fine-tune the model parameters based on newly arrived feedback data.

[0039] The present invention will be further described below with reference to a specific embodiment:

[0040] A supply chain forecasting and early warning method based on spatiotemporal graph neural networks is proposed. This method first requires acquiring multi-source heterogeneous data from the supply chain network, performing data cleaning and alignment, and then constructing a heterogeneous time-series graph of the supply chain. Specifically, various types of data, such as transaction records, inventory levels, transportation status, and supplier performance, can be collected from internal enterprise systems and external data sources. This raw data may contain inconsistent formats, missing values, or outliers, thus requiring cleaning, such as filling missing data through interpolation or identifying and correcting outliers through statistical methods. Subsequently, the cleaned data is aligned according to timestamps to ensure that information from different data sources synchronously reflects the state of the supply chain at a specific moment. Based on this, a heterogeneous graph representing supply chain entities and their relationships can be constructed, where nodes can represent suppliers, manufacturers, distributors, etc., and edges can represent transactions, transportation, or information flows between them. For example, different types of entities can be abstracted as nodes, and their business interactions can be abstracted as edges, with corresponding attribute characteristics assigned to nodes and edges.

[0041] After constructing the heterogeneous time-series graph of the supply chain, an end-to-end spatiotemporal graph neural network prediction model needs to be built and trained. This model aims to simultaneously capture the spatial structural dependence and temporal dynamic evolution of the supply chain network. The prediction model includes a spatial feature extraction module, a temporal feature extraction module, a spatiotemporal feature fusion module, and a prediction output module.

[0042] The spatial feature extraction module is used to capture high-order structural dependencies and semantic information in heterogeneous supply chain networks. This module can employ a graph neural network structure, for example, by aggregating the features of each node's neighbors and combining them with the node's own features to generate a spatial representation of that node. When processing heterogeneous networks, different weight matrices can be set for different types of nodes or edges to distinguish their importance in information transmission. For example, for a supply chain network containing suppliers and manufacturers, the feature transformation methods of supplier nodes and manufacturer nodes can be learned separately, and the transaction relationships between them can be weighted and aggregated.

[0043] The time feature extraction module is used to capture the long-term and short-term time evolution patterns of the supply chain status. This module can employ a sequence model structure, such as a recurrent neural network or a long short-term memory network, to process the historical time series data of each supply chain node. These models can learn the temporal dependencies between data points and generate a time representation that reflects the dynamic changes of nodes at different time steps. For example, a historical inventory level sequence of a manufacturer can be input, and this module can learn the trends and periodicity of inventory changes to predict future inventory status.

[0044] The spatiotemporal feature fusion module is used to deeply integrate the features obtained from the spatial feature extraction module and the temporal feature extraction module. This module can employ a simple fusion strategy, such as concatenating spatial and temporal features and then transforming them through a fully connected layer, or performing a weighted summation. This approach allows the model to simultaneously consider the structural and temporal dynamics of the supply chain network, forming a more comprehensive spatiotemporal joint representation. For example, the spatial and temporal embedding vectors of a node can be merged into a longer vector that simultaneously contains the node's location information within the network and its own state evolution information.

[0045] The forecast output module is used to output the predicted values ​​of key performance indicators (KPIs) for the supply chain over the next H time steps. _t+H. This module can consist of one or more fully connected layers that map the fused spatiotemporal features to specific predicted values. For example, the fused features can be input into a multilayer perceptron, whose output layer has H neurons, each corresponding to a predicted value at a future time step. These predicted values ​​can be key performance indicators (KPIs) of the supply chain, such as inventory levels, order volumes, or delivery times.

[0046] In obtaining predicted values Following `_t+H`, a risk warning module needs to be built. This module calculates node-level and network-level outage risk indices based on predicted values, preset dynamic thresholds, and a risk propagation dynamics model, and generates tiered warning signals that include risk level, risk source, and mitigation recommendations. Specifically, a series of static warning thresholds can be set; when the predicted value exceeds these thresholds, a risk alarm is triggered. The risk propagation dynamics model can be a simple set of rules; for example, if a supplier's risk index exceeds a certain level, the risk indices of its direct downstream manufacturers and distributors will also increase accordingly. The warning signal can be a simple text notification indicating that a node is at risk and providing some general mitigation recommendations.

[0047] Finally, this method employs a sliding window approach to input supply chain data into the prediction model in real time, dynamically updating the prediction results and early warning signals. It also utilizes an online incremental learning mechanism to fine-tune the model parameters based on newly arriving feedback data. Specifically, at regular time intervals, the latest supply chain data can be used as a new time window to input into the prediction model to obtain the latest prediction results and early warning signals. The online incremental learning mechanism can be a simple model update strategy; for example, when new data arrives, it can be used to perform small-batch gradient descent updates on the model to adapt to the new data distribution.

[0048] This application integrates multi-source heterogeneous data from the supply chain to construct a spatiotemporal graph neural network prediction model, achieving a deep capture of the spatial dependence and temporal evolution patterns of the supply chain network. This enables accurate prediction of key performance indicators (KPIs) of the supply chain, and, combined with a risk warning module, timely identification of potential disruption risks, providing tiered warning signals and response suggestions. Furthermore, through an online incremental learning mechanism, the model can continuously adapt to dynamic changes in the supply chain, ensuring the accuracy and timeliness of predictions and warnings, effectively improving supply chain resilience and management efficiency.

[0049] The explicit definition of the heterogeneous temporal graph G_t in step S1. This graph G_t is a snapshot at time t, composed of a node set V, an edge set E, a node feature matrix X_t, and a weighted adjacency matrix A_t. This definition provides a structured input for the subsequent spatiotemporal graph neural network model, ensuring that the model can handle the complexity and dynamism of the supply chain. The node set V includes various entity types in the supply chain network, such as suppliers, manufacturers, distributors, and logistics service providers. These different types of nodes represent different participants in the supply chain, each with unique attributes and functions. By uniformly modeling these heterogeneous entities as nodes in a graph, the compositional structure of the supply chain can be comprehensively represented, providing a foundation for subsequent analysis. The edge set E represents various relationships between nodes V, such as transaction relationships, transportation relationships, or information transfer relationships. These edges reflect the interactions and dependencies between different entities in the supply chain. By explicitly defining these relationships, the paths of material flow, information flow, and capital flow in the supply chain can be captured, thereby revealing the operational mechanism of the supply chain. The node feature matrix X_t is an N-row, F-column matrix, where N represents the number of nodes and F represents the feature dimension of each node. This matrix records the F-dimensional feature information of all N nodes at time t. These features can include, but are not limited to, inventory levels, order volume, production capacity, delivery time, and geographical location. By introducing the node feature matrix, the model can obtain detailed state information for each node, providing rich input for prediction. The weighted adjacency matrix A_t is an N-row, N-column matrix representing the connection strength or relationship weight between nodes at time t. The element values ​​of this matrix are dynamically calculated, based on indicators such as transaction frequency, transportation time, or cooperation strength. For example, higher transaction frequency and stronger cooperation may correspond to larger edge weights, and vice versa. By dynamically calculating edge weights, this matrix can reflect the tightness and changes in supply chain relationships in real time, enabling the graph structure to adapt to the dynamic evolution of the supply chain.

[0050] Through the above technical solution, this application clarifies the specific constituent elements and dynamic characteristics of the heterogeneous time-series graph G_t in the supply chain. This precise graph definition enables step S1 to construct a data model that highly replicates the complexity of the real supply chain. Specifically, the multi-type design of the node set V ensures comprehensive coverage of different roles in the supply chain; the multi-relationship type of the edge set E captures diverse interaction patterns between entities; the node feature matrix X_t provides rich node state information; and the dynamic calculation mechanism of the weighted adjacency matrix A_t can flexibly adjust the strength of connections between nodes based on real-time indicators such as transaction frequency, transportation duration, or cooperation intensity, thereby accurately reflecting the closeness and changes in supply chain relationships. Therefore, the subsequent spatiotemporal graph neural network prediction model can receive more informative and timely graph data in step S2, thus more effectively capturing high-order structural dependencies, semantic information, and long- and short-term evolution patterns in the supply chain, significantly improving the accuracy of prediction and the timeliness of early warning. This explicit and dynamic graph definition lays a solid foundation for the effective implementation of the entire prediction and early warning method, enabling it to better adapt to the complexity and dynamic changes of the supply chain.

[0051] The spatial feature extraction module in step S2 specifically includes: a type mapping layer, used to project node features and edge features of different categories onto a unified semantic space through a specific type of learnable linear transformation; and a relation-aware attention layer, which independently calculates the attention coefficients between node i and its neighbor j for each meta-path or relation type r: e_{ij}^r =LeakyReLU( (a^r)^T [ W_{src}^{τ(i)} h_i || W_{dst}^{τ(j)} h_j || W_{edge}^re_{ij} ] ), where τ(·) represents the node type, h_i is the hidden state of node i, W is the learnable weight matrix of the corresponding type or relation, a^r is the attention parameter vector of relation r, e_{ij} is the edge feature, and || represents the concatenation operation; Normalization and aggregation layer, within each relation, the attention coefficient e_{ij}^r is normalized using the softmax function to obtain α_{ij}^r, and based on this, the transformation features of the neighbors are weighted and summed to obtain the relation-specific node representation h_i^{r'} = σ(Σ_{j∈N_i^r} α_{ij}^r W_{dst}^{τ(j)} h_j ); Semantic fusion layer, using an attention mechanism or gating network, adaptively fuses the representations {h_i^{r'}} learned by node i under different relations to obtain the final spatial feature representation h_i^{spatial}.

[0052] Specifically, the type mapping layer aims to address the feature incompatibility problem caused by the heterogeneity of nodes and edges in supply chain networks. This layer projects node and edge features into a unified low-dimensional semantic space by configuring independent, learnable linear transformation matrices for different categories of node and edge features. For example, supplier, manufacturer, and distributor nodes may have different original feature dimensions and semantics; through their respective linear transformations, they are mapped to a shared feature representation space, enabling subsequent graph neural network layers to seamlessly process this heterogeneous information. This mapping not only preserves the key information of the original features but also provides a foundation for the interaction of different types of features.

[0053] The relation-aware attention layer is the core of this application for capturing complex relation dependencies. This layer independently calculates the attention coefficient e_{ij}^r between node i and its neighbor j for each meta-path or relation type r in the supply chain network. During the calculation, not only are the hidden states h_i and h_j of nodes i and j considered, but also the learnable weight matrices W_{src}^{τ(i)} and W_{dst}^{τ(j)} corresponding to node types τ(i) and τ(j), as well as the edge features e_{ij} and the learnable weight matrix W_{edge}^r corresponding to relation r. These features, after type- and relation-specific transformations, are concatenated, weighted by the attention parameter vector a^r of relation r, and then activated by the LeakyReLU function to obtain an attention score that accurately reflects the importance of neighbor j to node i under a specific relation r. This fine-grained attention mechanism enables the model to distinguish the impact of different relation types on node feature aggregation.

[0054] Building upon this, a normalization and aggregation layer further processes these attention coefficients. Within each relation type r, the attention coefficients e_{ij}^r are normalized using a softmax function to obtain normalized attention weights α_{ij}^r. These normalized weights are then used to perform a weighted summation of the transformed features W_{dst}^{τ(j)} h_j of neighbor j. In this way, node i can aggregate information from its neighbors N_i^r under a specific relation r to obtain a relation-specific node representation h_i^{r'}. For example, a manufacturer node might aggregate features from its supplier nodes through the "supply" relation, and simultaneously aggregate features from its distributor nodes through the "distribution" relation, forming two different relation-specific representations.

[0055] Finally, the semantic fusion layer is responsible for adaptively fusing multiple relation-specific representations {h_i^{r'}} learned by node i under different relations. This layer can employ attention mechanisms, such as a self-attention network to learn the importance of different relation representations, or a gated network (such as a gated recurrent unit or a gated convolutional network) to dynamically control and combine these relation-specific information flows. Through this fusion mechanism, the model can comprehensively consider the multiple roles played by nodes in the supply chain network and the multiple relations they participate in, thereby obtaining a comprehensive and semantically rich final spatial feature representation h_i^{spatial}.

[0056] Through the aforementioned technical solution, this application effectively projects the node and edge features of different categories in the supply chain network onto a unified semantic space, thereby overcoming the challenge of heterogeneous data processing and laying the foundation for subsequent feature learning. The relation-aware attention layer and the normalization and aggregation layer work together, independently calculating attention coefficients for each meta-path or relation type and performing normalization aggregation. This enables the model to meticulously capture the complex dependencies and semantic information between different types of nodes under specific relations, avoiding the heterogeneity effects that simple graph attention mechanisms might ignore. Finally, the semantic fusion layer adaptively fuses the representations learned by nodes under different relations using an attention mechanism or gating network, thereby generating a more comprehensive and accurate spatial feature representation. This hierarchical and refined spatial feature extraction mechanism significantly improves the model's ability to capture high-order structural dependencies and semantic information in heterogeneous supply chain networks, providing high-quality input for subsequent spatiotemporal feature fusion and prediction tasks, thus improving the accuracy of supply chain prediction and the timeliness and precision of early warning.

[0057] The temporal feature extraction module in step S2 specifically includes: a sequence embedding layer, a gated dilated causal convolutional layer, and an output layer.

[0058] The sequence embedding layer transforms the input node feature sequence X ∈ R^(N×T×F) through 1x1 convolutions, adding learnable positional encodings to preserve temporal order information. Specifically, 1x1 convolution is a lightweight convolutional operation that primarily adjusts the channel dimension of the input features, such as reducing or increasing dimensionality, while introducing non-linear transformations to map the original F-dimensional features to an embedding space more suitable for model processing. The learnable positional encodings provide a unique vector representation for each time step in the sequence. This vector, superimposed on the node features, allows the model to perceive and utilize the temporal order of data, which is crucial for understanding the dynamic evolution of the supply chain.

[0059] A gated dilated causal convolutional layer consists of L stacked residual blocks. Each residual block contains two parallel dilated causal convolution operations: one for outputting the main features and the other as a gate. Let the input of the l-th layer be z^{l-1} and the dilation factor be d_l. Then the output z^l of this layer is calculated as: z^l = (z^{l-1} * W_f^l + b_f^l) σ(z^{l-1} * W_g^l + b_g^l) + z^{l-1}, where * denotes a causal convolution with an inflation factor of d_l, and W_f and W_g are the kernel weights. For element-wise multiplication, σ is the sigmoid activation function. This layer is the core of temporal feature extraction. By stacking residual blocks, it helps alleviate the vanishing gradient problem in deep network training, ensuring smooth information transfer within the network. Dilated causal convolution expands the receptive field by inserting holes between kernel elements, enabling the model to capture dependencies between data points that are far apart in the time series without increasing computation. The causal nature of convolution ensures that when predicting the current time step, the model relies only on past and current information, meeting the practical needs of time series prediction. The gating mechanism (generated by the sigmoid activation function) selectively controls the flow of main features, allowing the model to focus on important temporal information while suppressing irrelevant noise.

[0060] The output layer passes the output of the last residual block through a fully connected layer or a global average pooling layer to obtain a compressed temporal feature representation h_i^{temporal}. This layer further integrates and compresses the high-dimensional temporal features extracted by the gated dilated causal convolutional layer, generating a fixed-dimensional and representative temporal feature vector. The fully connected layer maps features to the target dimension through linear transformations and non-linear activations. The global average pooling layer effectively aggregates the overall temporal information of the sequence by averaging the features across all time steps, further reducing the feature dimensionality and providing a refined input for the subsequent spatiotemporal feature fusion module.

[0061] Through the above technical solution, this application can effectively convert the original node feature sequence into a unified semantic space representation, and accurately preserve the temporal order information by utilizing learnable positional encoding, thus solving the complexity problem of directly processing the original data. The gated dilated causal convolutional layer significantly expands the receptive field by stacking residual blocks and exponentially increasing the dilation factor, enabling the model to capture long-distance temporal dependencies in the supply chain state. Simultaneously, the selective information flow control of the gating mechanism effectively filters noise and focuses on key temporal patterns. Finally, the output layer efficiently compresses the extracted temporal features, generating a refined and representative temporal feature representation, providing high-quality input for subsequent spatiotemporal feature fusion, thereby significantly improving the model's ability to capture and predict the dynamic evolution of the supply chain.

[0062] The spatiotemporal feature fusion module in step S2 specifically includes: a multi-head cross-attention layer, an adaptive gating fusion layer, and a feedforward network layer.

[0063] The multi-head cross-attention layer aims to achieve deep interaction between spatial and temporal features. This layer maps spatial features H_s to a query matrix Q = H_s W_Q, and temporal features H_t to a key matrix K = H_t W_K and a value matrix V = H_t W_V. This step projects the original spatial and temporal features H_s and H_t into different semantic spaces using learnable weight matrices W_Q, W_K, and W_V, generating the query matrix Q, key matrix K, and value matrix V. This mapping operation allows features from different modalities to undergo dimensional alignment and information transformation before attention computation, better adapting to the computational requirements of the attention mechanism and allowing the model to learn the optimal representation for each query, key, and value. Subsequently, the cross-attention output is calculated: Head_i = Attention(Q_i, K_i, V_i) = softmax( (Q_i K_i^T) / √d_k )V_i, where d_k is the dimension of the key vector. This formula describes the computation process of a single attention head. First, the similarity or relevance score between the query and the key is calculated by multiplying the query matrix Q_i by the transpose of the key matrix K_i. Next, this score is scaled by dividing by the square root of the key vector dimension d_k to prevent the inner product from becoming too large and causing the gradient to vanish in the softmax function. Then, the score is normalized using the softmax function to obtain the attention weights. Finally, these attention weights are multiplied by the value matrix V_i and summed to obtain the weighted value, which is the output of this attention head. This process allows the model to extract the most relevant information from the temporal features (keys and values) based on the spatial features (query). Then, the outputs of multiple heads are concatenated and linearly transformed to obtain cross-attention features. In the multi-head attention mechanism, each attention head independently computes its output. To integrate these attention information from different representation subspaces, the outputs of all attention heads are concatenated along the feature dimension. The concatenated features are then subjected to a linear transformation for dimensionality reduction or integration, resulting in a unified cross-attention feature containing multifaceted attention information. This approach enriches the feature representation, enabling it to capture more comprehensive and detailed spatiotemporal relationships.

[0064] The adaptive gated fusion layer aims to adaptively weight and fuse cross-attention features with the original spatial and temporal features. This layer calculates the fusion weight g = σ( [H_s || H_t] W_g + b_g). The calculation of the fusion weight g is based on the concatenation of the original spatial feature H_s and temporal feature H_t. The concatenated feature undergoes a linear transformation (defined by the weight matrix W_g and the bias b_g), followed by a sigmoid activation function σ, generating a gate value g between 0 and 1. This gate value g reflects the model's attention to the original spatiotemporal features and is used for subsequent weighted fusion. The final fused feature H_f = g ⊙H_cross + (1-g) ⊙ (H_s + H_t), where H_cross is the cross-attention feature, and ⊙ represents element-wise multiplication. This formula defines how the final fused feature H_f is calculated. Here, H_cross is the feature output by the multi-head cross-attention layer, and H_s and H_t are the original spatial and temporal features, respectively. The gating value g is used to weight H_cross, while (1-g) is used to weight the sum of the original features H_s and H_t. This gating mechanism enables the model to adaptively balance the deep interaction information captured by cross attention with the direct information of the original features, thereby generating a fused feature that contains complex associations while preserving the original semantics.

[0065] The feedforward network layer further performs nonlinear transformations and feature refinement based on the fused features H_f. This layer inputs the fused features H_f into a two-layer fully connected network, accompanied by residual connections and layer normalization, outputting the final spatiotemporal fusion representation. The adaptively gated fused features H_f are then input into a feedforward network containing two fully connected layers. The fully connected network can perform nonlinear mapping on the features, enhancing their expressive power. Simultaneously, the introduction of residual connections helps alleviate the gradient vanishing problem in deep network training and allows direct information transfer, preserving the effective information of the original features. Layer normalization helps stabilize the training process, accelerate convergence, and improve the model's generalization ability. Through these operations, the final spatiotemporal fusion representation can be used more stably and effectively for subsequent prediction tasks.

[0066] Through the aforementioned technical solution, this application introduces a multi-head cross-attention layer, an adaptive gated fusion layer, and a feedforward network layer into the spatiotemporal feature fusion module, achieving deep and adaptive fusion of spatial and temporal features. The multi-head cross-attention mechanism enables the model to capture the complex interactions between spatial and temporal information from multiple angles and in different semantic spaces, avoiding information loss that may result from simple splicing or fixed-weight fusion. The adaptive gated fusion layer further intelligently adjusts the fusion ratio of cross-attention features and original features based on the dynamic characteristics of the features, ensuring that the fused features not only reflect deep correlations but also retain the effective information of the original modalities. The feedforward network layer performs nonlinear refinement on the fused features and, combined with residual connections and layer normalization, effectively improves the expressive power of the fused features and the training stability of the model. Ultimately, this refined spatiotemporal feature fusion strategy enables the model to more comprehensively and accurately understand the dynamic changes in the supply chain, thereby significantly improving the prediction accuracy of key performance indicators and the reliability of risk warnings.

[0067] The specific implementation of the risk warning module in step S3 includes a dynamic threshold generation submodule, a node risk index calculation submodule, a risk propagation and tracing submodule, and a warning level generation submodule.

[0068] The dynamic threshold generation submodule dynamically updates the upper and lower limits of the warning thresholds θ_i^u(t) and θ_i^l(t) for each indicator at each node based on historical prediction residuals and real-time data streams using an exponentially weighted moving average method. Traditional fixed thresholds or simple statistical thresholds are difficult to adapt to the dynamic changes in the supply chain. This submodule assigns higher weights to recent data using the exponentially weighted moving average method, enabling the warning thresholds to reflect the latest fluctuations in the supply chain and the performance of the prediction model in real time. For example, when the prediction residuals continue to increase, the thresholds automatically widen to avoid frequent false alarms; when the residuals tend to stabilize, the thresholds tighten to improve the sensitivity of the warnings. This adaptive mechanism ensures that the warning thresholds remain synchronized with the actual operating status of the supply chain and the accuracy of the prediction model, thereby improving the accuracy and robustness of the warnings.

[0069] The node risk index calculation submodule is used to calculate the node risk index based on the predicted value. The degree of deviation of _i(t) from the dynamic threshold, and the duration of the deviation, are used to calculate the comprehensive risk index r_i(t) = f(deviation, duration) of node i at time t. Instantaneous deviation of the predicted value from the threshold alone may not be sufficient to comprehensively assess the risk. This submodule considers not only the predicted value... The degree of deviation (e.g., magnitude and direction of deviation) between _i(t) and the dynamic thresholds θ_i^u(t) and θ_i^l(t) is considered, along with the duration of the deviation. For example, a slight deviation over a short period may not pose a high risk, but a sustained deviation over a long period, even if small in magnitude, may indicate potential systemic problems. By comprehensively considering these two dimensions, the risk level of individual supply chain nodes can be quantified more accurately, avoiding overreaction to momentary fluctuations or delayed warnings due to long-term hidden dangers. The function f can be a weighted sum, product, or a more complex nonlinear function used to map the degree and duration of deviation to a unified risk index.

[0070] The risk propagation and tracing submodule constructs a directed weighted risk propagation graph with node weights r_i(t) and edge weights representing the mutual influence coefficients between supply chain nodes. Using graph convolutional networks or random walk algorithms, it simulates the propagation path and impact range of risk within the network and traces back to the most likely "risk source" node. Risks in the supply chain are often not isolated but propagate through complex network structures. This submodule first constructs a directed weighted graph where node weights are the previously calculated node risk index r_i(t), and edge weights quantify the mutual influence strength between supply chain nodes (e.g., the impact of a supplier's delay on downstream manufacturer production). Using graph convolutional networks or random walk algorithms, this submodule can simulate how risks spread within the supply chain network, predicting their potential scope and extent of impact. More importantly, it can trace back to identify the most likely "risk source" node leading to the current risk state, which is crucial for taking precise risk intervention measures. For example, when a manufacturer faces risk, this submodule can identify which upstream supplier's anomaly caused this risk.

[0071] The early warning level generation submodule maps the calculated network-level risk index R(t) and identified risk source information to four levels: "Attention," "Alert," "Warning," and "Alarm." Based on a pre-defined rule base, it generates decision recommendations including specific action steps. The ultimate goal of risk early warning is to provide actionable guidance. This submodule maps the comprehensively evaluated network-level risk index R(t) (e.g., obtained by aggregating the risk indices of all nodes or specific key nodes) and the risk source information identified by the risk propagation and tracing submodule to pre-defined, easily understood risk levels, such as "Attention," "Alert," "Warning," and "Alarm." Each level corresponds to a different level of urgency and recommended response measures. Furthermore, based on a pre-defined rule base (e.g., when the risk source is a specific supplier and the risk level is "Warning," it recommends activating an alternative supplier plan), this submodule generates decision recommendations including specific action steps, providing supply chain managers with clear and timely action guidelines.

[0072] Through the above technical solutions, the risk warning module of this application can significantly improve the accuracy, timeliness, and operability of supply chain risk warnings. The dynamic threshold generation submodule enables warning thresholds to adapt to supply chain fluctuations and the performance of prediction models in real time, avoiding false alarms or missed alarms caused by inappropriate thresholds. The node risk index calculation submodule comprehensively considers the degree and duration of prediction deviations, providing more comprehensive and detailed risk quantification and effectively distinguishing between instantaneous fluctuations and potential systemic risks. The risk propagation and tracing submodule, by constructing a refined risk propagation graph and applying graph algorithms, can not only accurately simulate the diffusion path and impact range of risks in the network, but more importantly, it can trace back and identify the most likely risk sources, providing a basis for precise intervention. Finally, the warning level generation submodule transforms complex risk information into intuitive graded warning signals and provides specific handling suggestions, greatly enhancing the practicality and decision support capabilities of warning information. These improvements collectively ensure that supply chain managers can identify potential risks earlier and more accurately, and take targeted measures, thereby effectively reducing the risk and losses of supply chain disruptions.

[0073] Please see Figure 2 As shown, the online incremental learning mechanism in step S4 specifically includes the following steps: Step S41, real-time data stream processing and sample construction: The system continuously receives real-time data streams from multiple sources, and after the same data cleaning and feature engineering process as in step S1, forms the node feature matrix X_t and adjacency matrix A_t at the current time t; Step S42, prediction and early warning service: The current sliding window data is input into the deployed spatiotemporal graph neural network prediction model to obtain the predicted value for the next H steps. _{t+1:t+H}, and the risk warning module generates a real-time warning signal; Step S43, update the trigger condition judgment, including timed trigger and performance trigger; Step S44, online incremental update algorithm; Step S45, model version management and rollback, after each incremental update, a new model version is generated and its performance indicators are recorded; if the performance of the new version on the validation set drops significantly, the system automatically rolls back to the previous stable version and triggers an alarm, prompting manual intervention to check the data or update the strategy.

[0074] Step S41 aims to provide continuous, high-quality input data for online incremental learning. The system continuously receives real-time data streams from various multi-source sensors (e.g., order systems, logistics tracking systems, inventory management systems, market intelligence systems, etc.). This raw data undergoes the same feature engineering processes as in step S1, including data cleaning, missing value imputation, outlier handling, and feature normalization, to ensure data quality and consistency. Subsequently, this processed data is organized into a node feature matrix X_t and an adjacency matrix A_t at the current time t, serving as the latest samples for incremental learning by the model. This process ensures that the model always has access to the latest supply chain status information, providing a timely data foundation for subsequent predictions and early warnings.

[0075] Throughout the online incremental learning process, the system continuously provides prediction and early warning services, as described in step S42. Specifically, the sliding window data at the current moment is input into the deployed spatiotemporal graph neural network prediction model. Based on its current parameter state, the model outputs predicted values ​​of key performance indicators for the supply chain over the next H time steps. _{t+1:t+H}. Simultaneously, the risk warning module generates real-time risk warning signals based on these predicted values, preset dynamic thresholds, and the risk propagation dynamics model. This step ensures that even during gaps in model incremental updates or while waiting for updates, the system can continuously provide users with critical prediction and warning information, maintaining business continuity.

[0076] To intelligently determine when to initiate the online incremental learning process, balancing model freshness with computational resource consumption, this application establishes an update trigger condition judgment in step S43. The update trigger conditions include two mechanisms: timed triggering and performance triggering. Timed triggering refers to the system automatically initiating model updates at preset time intervals (e.g., hourly, daily, or weekly). Performance triggering is more dynamic; when the system detects a continuous increase in the model's prediction error on the validation set, a decrease in prediction accuracy, or a significant change in the distribution of input data (e.g., through drift detection algorithms), it automatically triggers incremental updates. The combination of these two triggering mechanisms ensures that the model can both periodically adapt to environmental changes and respond promptly when performance issues arise, avoiding long-term performance degradation.

[0077] When the update trigger condition is met, the system initiates the online incremental update algorithm in step S44, adjusting the parameters of the spatiotemporal graph neural network prediction model using newly collected data. This algorithm aims to enable the model to learn the latest data patterns and trends while retaining as much knowledge as possible from historical data. Specific update strategies may include, but are not limited to, gradient descent-based optimization methods, such as the Adam optimizer, which iteratively updates the model weights by calculating the loss function. Through this step, the model can continuously adapt to the dynamic changes in the supply chain environment, maintaining the timeliness and accuracy of its predictive capabilities.

[0078] To ensure the stability and reliability of the online incremental learning process and prevent unsuccessful updates from negatively impacting the system, this application also includes model version management and rollback in step S45. After each incremental update, the system generates a new model version and records detailed performance metrics (e.g., mean squared error, mean absolute error, prediction accuracy, etc.) on the independent validation set. Before deploying the new version, the system rigorously evaluates its performance. If the performance of the new version on the validation set is found to be significantly lower than the old version, the system will automatically perform a rollback operation, restoring to the previous stable model version. Simultaneously, the system triggers an alarm mechanism to notify operations personnel or data scientists to intervene, check data quality, update strategies, or model configurations to diagnose problems and take corrective measures. This mechanism effectively reduces the risks associated with online incremental learning and ensures the continuous high availability of prediction and early warning services.

[0079] Through the above technical solutions, this application can effectively address the dynamics and complexity of supply chain data flows, ensuring the continuous high accuracy and stability of the prediction and early warning model. Specifically, the real-time data stream processing and sample construction step S41 provides the model with a continuous stream of cleaned and aligned latest data, guaranteeing the timeliness of model learning. During model updates, the prediction and early warning service step S42 ensures that the system can continuously provide key information, maintaining business continuity. The update trigger condition judgment step S43 intelligently balances the timeliness of model updates with the consumption of computing resources, avoiding unnecessary updates or update delays. The online incremental update algorithm step S44 enables the model to dynamically adjust parameters based on new data, adapting to constantly changing supply chain patterns. Most importantly, the model version management and rollback step S45 provides a robust risk control mechanism for online incremental learning. Through performance evaluation and automatic rollback, it effectively avoids model performance degradation or system instability caused by improper incremental updates, thereby significantly improving the robustness, reliability, and practical value of the supply chain prediction and early warning system.

[0080] In step S41, a sliding window of length T is used to form an online training sample (X_{t-T+1},..., X_t} by combining the latest T time-step data {X_{t-T+1},..., X_t} with the corresponding future H-step true labels Y_{t+1:t+H}, and store it in the experience replay pool D. The experience replay pool D adopts a first-in-first-out strategy and has a fixed capacity of M to ensure that the most recent representative samples are stored.

[0081] Specifically, the sliding window is a common technique for processing time-series data streams. It defines a fixed-length window T, which contains a continuous data segment from t-T+1 to t at each time step t. This mechanism ensures that the data used to construct training samples is always the latest historical data, thus providing the model with the most relevant contextual information at the current moment. The online training samples are constructed by using the node feature sequence X_{t-T+1:t} captured within the sliding window and the weighted adjacency matrix A_{t-T+1:t} as input to the model, while using the true labels Y_{t+1:t+H} for the next H time steps as the model's prediction target. Where X_{t-T+1:t} represents the F-dimensional feature matrix sequence of all N nodes in the supply chain network during time step t-T+1 to t; A_{t-T+1:t} represents the weighted adjacency matrix sequence of the connection relationships between nodes in the supply chain network within the same time period; and Y_{t+1:t+H} represents the actual observed values ​​of key performance indicators of the supply chain within the next H time steps from t+1 to t+H. In this way, each sample completely contains the historical inputs and corresponding future true outputs required for model prediction, providing the necessary data structure for supervised learning. The experience replay pool D is a data structure used to store these online training samples. Its main function is to break the temporal correlation between continuous data samples, thereby improving the stability and efficiency of model training. By randomly sampling from the experience replay pool D, the model can learn a wider and more diverse range of data patterns, avoiding training bias caused by data sequence. The first-in, first-out (FIFO) strategy is a management mechanism of the experience replay pool D. When the experience replay pool D reaches its preset fixed capacity M, whenever a new online training sample is added, the oldest sample stored in the experience replay pool D is removed. This strategy ensures that the experience replay pool D always contains the freshest and most relevant historical data, effectively preventing the model from learning outdated or no longer applicable data patterns. The fixed capacity M refers to the maximum number of samples that the experience replay pool D can store. M is a configurable hyperparameter, and its size determines the historical time range and sample diversity that the experience replay pool D can cover. Setting a reasonable value for M can ensure data freshness while also ensuring efficient use of computing resources and memory.

[0082] Through the above technical solutions, this application effectively addresses the key challenges of data sample management in online incremental learning. Specifically, by employing a sliding window mechanism, it ensures that the input data used for model training each time is the latest historical information, enabling the model to capture the latest dynamics of the supply chain in a timely manner. The construction of online training samples provides the model with structured and complete learning instances, enabling it to accurately learn and predict future trends from historical data. More importantly, by introducing an experience replay pool D with a fixed capacity and a first-in-first-out (FIFO) strategy, this application achieves effective management of training samples. The FIFO strategy ensures that the samples in the experience replay pool D always maintain high timeliness, avoiding model bias or performance degradation due to learning outdated data. At the same time, the fixed capacity M design not only effectively controls the consumption of memory and computing resources, but also ensures that the sample set in the experience replay pool D contains sufficient historical diversity to enhance the model's generalization ability, while preventing excessively old data from interfering with the model's adaptability to the current supply chain state. This sample management mechanism works closely with the online incremental learning mechanism, enabling the predictive model to continuously and stably learn and update from real-time data streams. This significantly improves the accuracy of supply chain forecasting and the timeliness of early warnings, especially in scenarios where the supply chain environment is changing rapidly. It ensures that the model remains sensitive to the latest business models and risk factors.

[0083] When the triggering condition is met, the following incremental learning process is executed. First, sampling is performed. Specifically, a sample set D_batch of batch size B is randomly sampled from the experience replay pool D. To ensure that the model can take into account both the latest trends reflected by recent samples and the long-term patterns contained in historically representative samples, a priority experience replay mechanism can be adopted as the sampling strategy. Under this mechanism, the system assigns higher sampling weights to samples based on their prediction errors, enabling the model to learn more frequently those samples that are difficult to predict or have large prediction errors, thereby improving learning efficiency and the model's adaptability to complex situations. In addition to priority experience replay, a time-decay-based sampling strategy can also be used, or stratified sampling can be performed based on the importance of the samples (e.g., representing key events or anomalies).

[0084] Next, the joint loss is calculated. This loss function consists of two weighted parts. The first part is the new data fitting loss L_new, which calculates the model predictions on the sampled D_batch. The Huber loss is used to compare the model with the true value Y. The Huber loss combines the advantages of mean squared error (MSE) and mean absolute error (MAE), exhibiting a quadratic function for small errors and a linear function for large errors. This makes the model more robust to outliers when fitting new data distributions, ensuring that the model can stably learn the latest data patterns. The second part is the knowledge distillation loss L_distill, which aims to preserve old knowledge. Specifically, it approximates the output of the current model (student model) on old samples with the output of the model before the update (teacher model). In each sampled batch, the teacher model's predictions are simultaneously computed. _teacher, then calculate the student model predictions. Student and Teacher Predictions The mean squared error or KL divergence between `_teacher` values ​​is used as the distillation loss L_distill. Mean squared error is suitable for regression tasks, while KL divergence is suitable for outputs that are probability distributions. The total loss L is the weighted sum of L_new and L_distill, i.e., L = L_new + λ * L_distill, where λ is a balance coefficient whose value can be dynamically adjusted according to the amount of new data and the importance of old knowledge to achieve the optimal balance between adapting to new data and retaining old knowledge.

[0085] Next, gradient calculation and parameter updates are performed. Specifically, the Adam optimizer is used to calculate the gradient of the model parameters θ based on the calculated total loss L, and the model parameters θ are updated using one or more steps of gradient descent. The Adam optimizer is an adaptive learning rate optimization algorithm that can efficiently handle sparse gradients and non-stationary objectives, thereby accelerating model convergence and improving training stability.

[0086] Finally, a soft update of the teacher model is performed. To prevent the teacher model from becoming outdated, the teacher model parameter θ_teacher is updated every certain number of steps using the exponential moving average (EMA). The update formula is: θ_teacher = α * θ_teacher + (1-α) * θ_student, where α is a decay factor close to 1. This soft update mechanism allows the teacher model to slowly absorb new knowledge learned by the student model, thus maintaining the up-to-dateness of its knowledge and avoiding losing its value as a stable source of knowledge due to rapid changes.

[0087] Through the above technical solutions, this application effectively addresses the catastrophic forgetting problem that may occur in online incremental learning models, ensuring the accuracy and stability of predictions in the continuously evolving supply chain data flow. Specifically, by adopting a sampling strategy that considers both recent samples and historically representative samples, the model can selectively learn samples that have a significant impact on current predictions or are historically important, thereby improving learning efficiency and the model's adaptability to complex situations. The Huber loss in the joint loss function makes the model more robust to outliers when fitting new data, ensuring stable learning of the latest data patterns. Simultaneously, the introduction of knowledge distillation loss allows the model to effectively retain the rich knowledge contained in the old model while learning new knowledge, avoiding catastrophic forgetting caused by incremental updates and ensuring consistent performance over long-term operation. Furthermore, the efficient gradient calculation and parameter update capabilities of the Adam optimizer, along with the exponential moving average soft update mechanism of the teacher model, jointly ensure the stability and continuous optimization capabilities of the entire online incremental learning process, enabling the prediction model to continuously adapt to changes in the supply chain environment and provide more accurate and reliable prediction and early warning services.

[0088] A computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the above-described method.

[0089] Specifically, the computer-readable storage medium refers to a physical carrier capable of recording and storing digital data or information. This medium can be, but is not limited to, volatile storage media, such as random access memory (RAM), or non-volatile storage media, such as read-only memory (ROM), flash memory, hard disk drive, solid-state drive, optical disk, Universal Serial Bus (USB) flash drive, or Secure Digital (SD) card. Its core function is to provide persistent or temporary storage space for computer programs, ensuring that program code and related data can be reliably loaded and accessed when needed by the processor.

[0090] The computer program is a collection of instructions designed to instruct the computer to perform specific tasks or operations. This program typically exists as source code (written in programming languages ​​such as Python, Java, and C++) or compiled and interpreted machine code. When executed by a processor, the program guides the processor to process data and perform calculations according to a predetermined logical flow, thereby realizing all the steps of the aforementioned supply chain forecasting and early warning methods. This includes, but is not limited to, the construction of heterogeneous supply chain time series diagrams, the training and inference of spatiotemporal neural network prediction models, the calculation of risk warning modules, and the implementation of online incremental learning mechanisms.

[0091] When the program is executed by the processor, it implements the above-described method, meaning that the computer program is the concrete implementation carrier of the aforementioned prediction and early warning methods. The processor, such as a central processing unit (CPU), graphics processing unit (GPU), or neural network processor (NPU), reads and interprets program instructions stored on a computer-readable storage medium, transforming abstract method steps into actual computational operations. This process ensures real-time input of supply chain data, efficient calculation of predictive models, accurate assessment of risk indices, and timely generation of early warning signals, thereby enabling the entire prediction and early warning system to operate automatically, efficiently, and stably.

[0092] Through the above technical solution, this application can solidify the abstract supply chain forecasting and early warning method based on spatiotemporal graph neural networks into a computer program and store it on a computer-readable storage medium, which can then be executed by a processor. This not only solves the problem that a purely method description is difficult to run directly on hardware in practical applications, but also enables the method to be conveniently and efficiently deployed on various computing devices, such as servers, edge computing devices, or personal computers, thereby realizing the scalability, real-time capability, and intelligence of supply chain forecasting and early warning services. The processor's execution of the program ensures efficient computation of the forecasting model and timely response to risk warnings, greatly improving the automation level and decision-making efficiency of supply chain management, and providing enterprises with reliable intelligent decision support.

[0093] The application scenarios of this invention are as follows:

[0094] This embodiment focuses on the aftermarket parts supply chain network of a large automobile manufacturer. This network covers 32 major cities nationwide and includes:

[0095] 5 central warehouses

[0096] 32 regional distribution centers (covering provincial capitals and key cities)

[0097] 187 4S stores and authorized service stations (as end nodes)

[0098] 23 core component suppliers (including suppliers of key components such as engines, transmissions, and electronic control systems)

[0099] The supply chain network has a total of 247 nodes (N) and 856 directed edges (representing material flow). The data spans from January 1, 2022 to December 31, 2025, totaling 4 years and 1461 days of daily data. Data sources include:

[0100] ERP system: Daily inventory, inbound orders, outbound orders, purchase orders

[0101] WMS system: Inventory turnover rate, inventory aging analysis, picking efficiency

[0102] TMS system: In-transit inventory, transit time, on-time delivery rate

[0103] Supplier collaboration platform: supplier capacity, production schedule, and material availability.

[0104] IoT devices: warehouse temperature and humidity, AGV vehicle operating status, and inbound / outbound barcode scanning records.

[0105] Based on the method in step S1, construct the heterogeneous time series graph G_t = (V, E, X_t, A_t).

[0106] The node types and feature configurations are shown in Table 1 below.

[0107] Table 1. Node Type and Feature Configuration Table:

[0108] Node type Number of nodes Feature Dimension Feature Description Supplier Node 23 16 Capacity utilization rate, raw material inventory, order backlog, on-time delivery rate, quality pass rate, transit days, price index, historical delivery reliability score, etc. Central warehouse 5 18 Inventory levels, safety stock threshold, average daily outbound volume, planned inbound volume, inventory age distribution, warehouse capacity utilization, picking efficiency, and reverse flow rate, etc. Regional distribution center 32 15 Regional inventory levels, number of 4S stores covered, average daily demand forecast, regional seasonality index, local procurement ratio, frequency of emergency transfers, etc. 4S store / repair station 187 12 Workstation occupancy rate, number of scheduled repairs, frequency of emergency orders, consumption rate of commonly used parts, customer waiting time, number of vehicles in the local area, etc.

[0109] Edge type and weight calculation method: The edge weight A_ij(t) adopts a dynamic weighting mechanism, integrating multi-dimensional indicators.

[0110] Transaction frequency weight: w_freq = (number of transactions in the past 30 days) / (maximum number of transactions)

[0111] Transportation timeliness weight: w_time = exp(-transportation days / base number of days)

[0112] Cooperation strength weighting: w_coop = Cooperation duration / 10 + Historical order completion rate × 0.5

[0113] Final weights: A_ij(t) = α·w_freq + β·w_time + γ·w_coop, where α, β, and γ are determined by fitting historical data. In this embodiment, α = 0.4, β = 0.35, and γ = 0.25.

[0114] The spatiotemporal graph neural network model is implemented using the PyTorch framework, and the main parameter configurations are as follows:

[0115] 3.1 Spatial Feature Extraction Module

[0116] Employ a relation-aware multi-head graph attention network with the following configuration parameters:

[0117] Input feature dimension F=16 (features of different node types are uniformly mapped to 16 dimensions).

[0118] Hidden layer dimension H=64

[0119] Multi-head attention count K=8

[0120] Number of relation types R=4 (Supplier → Central Warehouse, Central Warehouse → Distribution Center, Distribution Center → 4S Store, Same-level Transfer)

[0121] Dropout rate = 0.2

[0122] LeakyReLU negative slope = 0.2

[0123] For each relation type r, the attention coefficient is calculated as follows: e_{ij}^r = LeakyReLU( (a^r)^T [ W_src^τ(i) h_i || W_dst^τ(j) h_j || W_edge^r e_{ij} ] )

[0124] Among them, the node type mapping matrix W_src and W_dst are both 16×64 in dimension, and the edge feature mapping matrix W_edge^r is 5×64 in dimension (the original dimension of the edge feature is 5, including transportation distance, average transportation time, contract amount, cooperation period, and historical on-time rate).

[0125] The semantic fusion layer uses an attention mechanism to automatically learn the importance of each relation and outputs the final spatial feature h_i^spatial ∈ R^64.

[0126] 3.2 Time Feature Extraction Module

[0127] A gated dilated causal convolutional network is used, with the following parameters configured:

[0128] Input sequence length T = 30 days

[0129] Prediction step size H = 7 days (output daily forecast values ​​for the next week)

[0130] kernel size k=3

[0131] The number of residual block layers is L=5, and the expansion factor of each layer is d=[1,2,4,8,16].

[0132] Hidden channel number C=64

[0133] The gating mechanism uses a GLU (Gated Linear Unit).

[0134] The calculation process for each layer is: z^l = (z^{l-1} * W_f^l + b_f^l) σ(z^{l-1} * W_g^l + b_g^l) + z^{l-1}

[0135] The output layer performs global average pooling on the output of the last residual block to obtain the temporal feature representation h_i^temporal ∈ R^64.

[0136] 3.3 Spatiotemporal Feature Fusion Module

[0137] Employing a multi-head cross-attention mechanism combined with adaptive gating:

[0138] Cross-attention head count = 8

[0139] Key / Query Dimension d_k=32

[0140] The fusion weight is calculated as follows: g = σ( [h_s || h_t] W_g + b_g), where W_g has a dimension of 128×64.

[0141] The final fused feature h_f = g ⊙ Attention(h_s, h_t) + (1-g) ⊙ (h_s + h_t)

[0142] 3.4 Prediction Output Module

[0143] Employs a three-layer fully connected network:

[0144] First layer: 128-dimensional, ReLU activation, ReLU (Rectified Linear Unit).

[0145] Second layer: 64-dimensional, ReLU activation

[0146] Output layer: H = 7 dimensions (predicted values ​​for the next 7 days)

[0147] Dropout rate = 0.1 (for training only)

[0148] The loss function used is Huber loss, a robust regression loss function with δ=1.0. The optimizer used is Adam, an optimization algorithm widely used in deep learning (Adaptive Moment Estimation). The initial learning rate is 0.001, the batch size is 64, the number of training epochs is 300, and the early stopping mechanism patience is 30.

[0149] To clearly illustrate the data flow process of the model, Table 2 provides a specific input-output example (taking a central warehouse node as an example):

[0150] Data types Time / Content Eigenvalues illustrate Input node features Day t Inventory level = 12,500 units; Safety stock threshold = 8,000 units; Average daily outbound volume = 1,200 units / day; Planned inbound volume = 15,000 units; Storage capacity = 20,000 units... (Total 16 dimensions) Current inventory is below this value and needs to be replenished: Average of the past 7 days' inventory and maximum planned inventory for the next 3 days. Input adjacency matrix Day t Supplier A weight = 0.78, Distribution Center B weight = 0.65, Distribution Center C weight = 0.42 A weight greater than 0.7 indicates a strong association. Input historical sequence t-29 days to t day [9,800,10,200,...,12,500] 30-day inventory series Output predicted value t+1 day t+2 days ... t+7 days 12,100 pieces, 11,800 pieces... 8,900 pieces The prediction result is close to the safety threshold.

[0151] The risk warning module is configured as follows:

[0152] 5.1 Dynamic Threshold Generation

[0153] The early warning threshold is dynamically updated using an exponentially weighted moving average method.

[0154] Basic thresholds: The upper threshold is based on the 80th percentile of historical data from the same period, and the lower threshold is based on the 20th percentile.

[0155] Dynamic update: θ_i^u(t) = 0.9·θ_i^u(t-1) + 0.1·(historical 80th percentile)

[0156] Update cycle: Recalculated every 7 days

[0157] 5.2 Calculation of Node Risk Index

[0158] Taking into account both the magnitude and duration of the predicted deviation: r_i(t) = min(1, max(0, (d_i(t) - 0.2) / 0.5)) × min(1, t_dev / 3), where d_i(t) is the percentage of deviation and t_dev is the number of consecutive days of deviation. This formula ensures that a deviation within 20% or a duration of less than 3 days does not trigger a high risk.

[0159] 5.3 Risk Propagation Model

[0160] Construct a risk propagation graph and use a graph convolutional network to simulate 3-hop propagation: R_network(t) = Σ_i r_i(t) +0.3 Σ_i Σ_j P_ij r_i(t) r_j(t-1) + 0.1 Σ_i Σ_j Σ_k P_ij P_jk r_i(t) r_j(t-1) r_k(t-2) where P is the normalized adjacency matrix, reflecting the risk propagation intensity.

[0161] 5.4 Early Warning Level Classification

[0162] Network-level risk index R Warning Level Color Code Recommendations for handling R < 0.2 Attention level blue Maintain monitoring without intervention. 0.2 ≤ R < 0.4 Tip level yellow Relevant nodes are reminded to pay attention to inventory levels. 0.4 ≤ R < 0.6 Warning level orange color It is recommended to activate alternative suppliers or make emergency allocations. R ≥ 0.6 Alarm level red Emergency response plan triggered, management intervened.

[0163] The online incremental learning mechanism is implemented based on an online incremental learning algorithm that combines experience replay and knowledge distillation, as follows:

[0164] 6.1 System Deployment Environment

[0165] Hardware: 4 NVIDIA Tesla T4 GPU servers, each with 16GB of video memory

[0166] Software: Ubuntu 20.04, Python 3.8, PyTorch 1.12, Redis (for the experience replay pool)

[0167] Service architecture: The model prediction service is deployed in the form of a RESTful API, with a peak QPS of 200+.

[0168] A RESTful API is a web API design approach that follows the REST (Representational State Transfer) architectural style. Its core idea is to treat data and functionality on the server as "resources" and use standard HTTP methods to manipulate these resources; QPS (Query Per Second) refers to the number of queries a server can respond to per second.

[0169] 6.2 Configuration of Experience Replay Pool

[0170] The playback pool capacity M = 50,000 samples (approximately 4 months of daily data).

[0171] Storage format: Each sample contains a triplet of (X_window, A_window, Y_true).

[0172] Sampling strategy: Prioritize empirical replay, assign sampling weights based on the prediction error |ŷ - y|, with higher sampling probabilities for larger errors.

[0173] Replay pool eviction policy: First-in, first-out (FIFO) – the oldest sample is removed when a new sample enters.

[0174] 6.3 Incremental Update Triggering Conditions

[0175] Scheduled trigger: An incremental update is performed once a day at 2:00 AM (accumulating approximately 247 × 7 = 1,729 new prediction samples).

[0176] Performance Trigger: When the mean absolute percentage error of the most recent 100 predicted samples exceeds 8%, an emergency update is immediately triggered.

[0177] 6.4 Implementation of Incremental Update Algorithm

[0178] When the triggering condition is met, the incremental learning process is executed. First, a batch-sized sample set is randomly sampled from the experience replay pool. The sampling strategy considers both recent samples and historically representative samples; for example, prioritizing experience replay and assigning higher sampling weights based on the prediction error of the samples. Then, the joint loss function is calculated, which consists of two weighted parts: the new data fitting loss (calculating the Huber loss between the model's prediction and the true value on the sampled batch to ensure the model fits the new data distribution) and the knowledge distillation loss (applying the current model's output on old samples to approximate the model's output before the update to preserve old knowledge and prevent the model from forgetting historical patterns). The total loss is the weighted sum of these two parts. Next, the Adam optimizer is used to calculate the gradient based on the total loss, and the model parameters are updated using one or more steps of gradient descent. To prevent the teacher model from becoming outdated, the teacher model parameters are updated using an exponential moving average method at regular intervals.

[0179] 6.5 Model Version Management

[0180] After each incremental update, record the RMSE and MAPE metrics of the new version model on the validation set over the past 7 days and compare them with the previous version. If the MAPE increases by more than 1 percentage point, the rollback mechanism is automatically triggered.

[0181] Case 1: Stockout Alert from a Distribution Center in East China

[0182] On August 15, 2025, the model predicted that the transfer volume from the central warehouse to the distribution center would peak on August 22 (predicted value 3,200 units), exceeding the historical average for the same period by 40%. The risk warning module calculated the distribution center's risk index r=0.58 (orange warning level) and traced the risk source to a supplier's reduced capacity (capacity utilization rate dropped from 85% to 62%) through the risk propagation model. The system issued a warning on August 16, recommending that a backup supplier be activated in advance. After the company adopted the suggestion, the actual demand of the distribution center was 3,050 units, and the backup supplier replenished the supply in time, avoiding a potential sales loss of approximately 2 million yuan.

[0183] Case 2: Incremental Learning to Cope with the Impact of Double Eleven Promotions

[0184] In November 2025, influenced by the Double Eleven shopping festival, the demand pattern for accessories changed significantly. The model's prediction error rose to 12.3% on November 5th (exceeding the 8% threshold), triggering an emergency update. The system immediately executed an incremental update algorithm, sampling historical samples from the experience replay pool that included data from the previous year's Double Eleven period (the distillation loss weight λ was dynamically adjusted to 0.3, increasing the weight for fitting new data). After the update, the model's prediction error on November 11th dropped to 6.8%, successfully capturing the demand pulse brought about by the promotion. This case validates the rapid adaptability of the online incremental learning mechanism to non-stationary environments.

[0185] To verify the effectiveness of the method of this invention, a comparison was made with a benchmark model on the same dataset, and the results are shown in Table 3:

[0186] Model RMSE MAPE (%) Early warning accuracy rate (%) Warning lead time days ARIMA 4.87 21.3 52.3 1.2 LSTM 3.52 15.8 63.7 2.5 GCN 3.18 14.2 67.8 2.8 GAT 2.96 13.1 71.2 3.1 This invention (excluding incremental learning) 2.41 10.5 78.6 4.3 This invention (including incremental learning) 2.18 9.3 84.2 5.1

[0187] Experimental results show that the method of the present invention is significantly better than the existing methods in all indicators, with an RMSE of 2.18, which is 38.1% lower than that of the traditional LSTM; the early warning accuracy rate is 84.2%, and the average early warning time is 5.1 days, providing enterprises with sufficient decision-making buffer time.

[0188] The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made within the scope of the claims of the present invention should be included in the scope of the present invention.

Claims

1. A supply chain forecasting and early warning method based on spatiotemporal graph neural networks, characterized in that, Includes the following steps: Step S1: Obtain multi-source heterogeneous data from the supply chain network, perform data cleaning and alignment, and construct a heterogeneous time sequence diagram of the supply chain. Step S2: Construct and train an end-to-end spatiotemporal graph neural network prediction model, wherein the spatiotemporal graph neural network prediction model includes: The spatial feature extraction module employs a relation-aware multi-head graph attention network to assign independent attention mechanisms to different types of node-edge combinations in order to capture high-order structural dependencies and semantic information in the heterogeneous supply chain network. The temporal feature extraction module adopts a temporal convolutional network based on a gated dilated causal convolutional network. It expands the receptive field by stacking causal convolutional layers with an exponentially increasing dilation rate, and combines gated linear units to control the flow of temporal information in order to capture the long-term and short-term temporal evolution patterns of the supply chain status. The spatiotemporal feature fusion module adopts a multi-head cross-attention mechanism, using spatial features as the query matrix and temporal features as the key and value matrices, to perform deep interactive fusion, and outputs fused features through residual connections and layer normalization. The prediction output module passes the fused features through a multi-step predictor composed of fully connected layers to output predicted values ​​of key performance indicators for the supply chain over the next H time steps. _t+H; Step S3: Construct a risk warning module based on the predicted value. The system calculates the interruption risk index at the node and network levels using _t+H, preset dynamic thresholds, and risk propagation dynamics models, and generates a graded early warning signal that includes risk level, risk source, and handling suggestions; Step S4: Input supply chain data into the prediction model in real time using a sliding window method, dynamically update the prediction results and early warning signals, and use an online incremental learning mechanism to fine-tune the model parameters based on newly arrived feedback data.

2. The supply chain forecasting and early warning method based on spatiotemporal graph neural networks according to claim 1, characterized in that: The heterogeneous time-series graph of the supply chain in step S1 is defined as G_t = (V, E, X_t, A_t), where V is a set of nodes of various types including suppliers, manufacturers, distributors, and logistics service providers, E is a set of edges representing the transaction, transportation, or information transmission relationships between nodes, X_t ∈ R^(N×F) is the F-dimensional feature matrix of all N nodes at time t, and A_t ∈ R^(N×N) is the weighted adjacency matrix at time t, whose element values ​​are dynamically calculated based on transaction frequency, transportation duration, or cooperation strength.

3. The supply chain forecasting and early warning method based on spatiotemporal graph neural networks according to claim 1, characterized in that: The spatial feature extraction module in step S2 specifically includes: a type mapping layer, used to project node features and edge features of different categories onto a unified semantic space through a specific type of learnable linear transformation; and a relation-aware attention layer, which independently calculates the attention coefficients between node i and its neighbor j for each meta-path or relation type r: e_{ij}^r =LeakyReLU( (a^r)^T [ W_{src}^{τ(i)} h_i || W_{dst}^{τ(j)} h_j || W_{edge}^re_{ij} ] ), where τ(·) represents the node type, h_i is the hidden state of node i, W is the learnable weight matrix of the corresponding type or relation, a^r is the attention parameter vector of relation r, e_{ij} is the edge feature, and || represents the concatenation operation; Normalization and aggregation layer, within each relation, the attention coefficient e_{ij}^r is normalized using the softmax function to obtain α_{ij}^r, and based on this, the transformation features of the neighbors are weighted and summed to obtain the relation-specific node representation h_i^{r'} = σ(Σ_{j∈N_i^r} α_{ij}^r W_{dst}^{τ(j)} h_j ); Semantic fusion layer, using an attention mechanism or gating network, adaptively fuses the representations {h_i^{r'}} learned by node i under different relations to obtain the final spatial feature representation h_i^{spatial}.

4. The supply chain forecasting and early warning method based on spatiotemporal graph neural networks according to claim 1, characterized in that: The temporal feature extraction module in step S2 specifically includes: a sequence embedding layer, which performs channel transformation on the input node feature sequence X∈ R^(N×T×F) through 1x1 convolution and adds learnable positional encoding to preserve temporal order information; a gated dilated causal convolutional layer, which consists of L stacked residual blocks, each containing two parallel dilated causal convolution operations: one for outputting the main feature and the other as a gate; assuming the input of the l-th layer is z^{l-1} and the dilation factor is d_l, the output z^l of this layer is calculated as: z^l = (z^{l-1} * W_f^l + b_f^l) σ(z^{l-1} * W_g^l +b_g^l) + z^{l-1}, where * denotes a causal convolution with an inflation factor of d_l, and W_f and W_g are the kernel weights. For element-wise multiplication, The sigmoid activation function is used; the output layer passes the output of the last residual block through a fully connected layer or a global average pooling layer to obtain the compressed temporal feature representation h_i^{temporal}.

5. The supply chain forecasting and early warning method based on spatiotemporal graph neural networks according to claim 1, characterized in that: The spatiotemporal feature fusion module in step S2 specifically includes: a multi-head cross-attention layer, which maps spatial features H_s to a query matrix Q = H_s W_Q, and temporal features H_t to a key matrix K = H_t W_K and a value matrix V = H_tW_V, and calculates the cross-attention output: Head_i = Attention(Q_i, K_i, V_i) = softmax( (Q_i K_i^T) / √d_k ) V_i, where d_k is the dimension of the key vector. Then, the outputs of multiple heads are concatenated and linearly transformed to obtain the cross-attention features; an adaptive gated fusion layer, which calculates the fusion weight g = σ( [H_s || H_t] W_g + b_g ), and finally fuses the feature H_f = g ⊙H_cross + (1-g) ⊙(H_s + H_t), where H_cross is the cross-attention feature and ⊙ is the element-wise multiplication; the feedforward network layer inputs the fusion feature H_f into a two-layer fully connected network, accompanied by residual connections and layer normalization, and outputs the final spatiotemporal fusion representation.

6. The supply chain forecasting and early warning method based on spatiotemporal graph neural networks according to claim 1, characterized in that: The risk warning module in step S3 specifically includes: a dynamic threshold generation submodule, which dynamically updates the upper and lower thresholds θ_i^u(t) and θ_i^l(t) of each indicator for each node based on historical prediction residuals and real-time data streams using an exponentially weighted moving average method; and a node risk index calculation submodule, which calculates the node risk index based on the predicted values. The risk propagation and tracing submodule calculates the comprehensive risk index r_i(t) = f(deviation, duration) of node i at time t by considering the degree of deviation between _i(t) and the dynamic threshold, as well as the duration of the deviation. The risk propagation and tracing submodule constructs a directed weighted risk propagation graph with node weights r_i(t) and edge weights representing the mutual influence coefficients between supply chain nodes. It simulates the propagation path and impact range of risk in the network using graph convolutional networks or random walk algorithms, and traces back to the most likely "risk source" node. The warning level generation submodule maps the calculated network-level risk index R(t) and the identified risk source information to four levels: "attention, prompt, warning, and alarm," and generates decision suggestions containing specific handling steps based on a preset rule base.

7. The supply chain forecasting and early warning method based on spatiotemporal graph neural networks according to claim 1, characterized in that: The online incremental learning mechanism in step S4 specifically includes the following steps: Step S41: Real-time data stream processing and sample construction. The system continuously receives real-time data streams from multiple sources. After the same data cleaning and feature engineering process as in step S1, the node feature matrix X_t and adjacency matrix A_t are formed at the current time t. Step S42: Prediction and Early Warning Service. Input the current sliding window data into the deployed spatiotemporal graph neural network prediction model to obtain the predicted value for the next H steps. _{t+1:t+H}, and the risk warning module generates real-time warning signals; Step S43: Update the trigger condition judgment, including timed triggers and performance triggers; Step S44: Online incremental update algorithm; Step S45: Model version management and rollback. After each incremental update, a new model version is generated and its performance metrics are recorded. If the performance of the new version on the validation set drops significantly, the system automatically rolls back to the previous stable version and triggers an alarm, prompting manual intervention to check the data or update the strategy.

8. The supply chain forecasting and early warning method based on spatiotemporal graph neural networks according to claim 7, characterized in that: Step S41 is further specified as follows: using a sliding window of length T, the latest T time step data {X_{t-T+1}, ..., X_t} and the corresponding future H step true labels Y_{t+1:t+H} are combined to form an online training sample (X_{t-T+1:t}, A_{t-T+1:t}, Y_{t+1:t+H}), and stored in the experience replay pool D; the experience replay pool adopts a first-in-first-out strategy and has a fixed capacity of M to ensure that the most recent representative samples are stored.

9. A supply chain forecasting and early warning method based on spatiotemporal graph neural networks according to claim 8, characterized in that: Step S44 is further specified as follows: When the triggering condition is met, the following incremental learning process is executed: Sampling: Randomly sample a sample set D_batch of batch size B from the experience replay pool D; the sampling strategy takes into account both recent samples and historically representative samples, for example, prioritizing experience replay and assigning higher sampling weights based on the prediction error of the samples; Calculating the joint loss: The loss function consists of two weighted parts: New data fitting loss: Calculate model predictions on D_batch The Huber loss L_new, compared to the true value Y, ensures that the model fits the new data distribution. Knowledge distillation loss: To preserve old knowledge, distillation loss is introduced; the output of the current student model on old samples is approximated to the output of the teacher model before the update; specifically, in the sampling batch, the prediction of the teacher model is calculated simultaneously. _teacher, then calculate student model predictions The mean squared error or KL divergence between _student and teacher predictions is used as the distillation loss L_distill; the total loss is L = L_new + λ * L_distill, where λ is the balance coefficient, which can be dynamically adjusted according to the amount of new data and the importance of old knowledge. Gradient calculation and parameter update: Using the Adam optimizer, the gradient is calculated based on the total loss L, and the model parameters θ are updated by one or more steps of gradient descent. Soft update of teacher model: To prevent the teacher model from becoming outdated, the teacher model parameters are updated every certain number of steps using the exponential moving average method: θ_teacher = α * θ_teacher + (1-α) * θ_student, where α is a decay factor close to 1.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-9.