Karst spring flow prediction method and device based on heterogeneous spatiotemporal graph attention network

By constructing a heterogeneous spatiotemporal graph attention network, the problems of adaptive feature extraction and multi-relation fusion in karst spring flow prediction are solved, achieving higher accuracy and interpretability in flow prediction, which is applicable to groundwater resource management in karst areas.

CN122220985APending Publication Date: 2026-06-16YANGTZE DELTA REGION INST (QUZHOU) UNIV OF ELECTRONIC SCI & TECH OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YANGTZE DELTA REGION INST (QUZHOU) UNIV OF ELECTRONIC SCI & TECH OF CHINA
Filing Date
2026-03-18
Publication Date
2026-06-16

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately predict karst spring flow. Traditional physical models face challenges in parameter acquisition and model construction, while traditional machine learning models fall short in adaptive feature extraction and multi-relation fusion, failing to effectively capture the nonlinear and multi-scale characteristics of karst hydrological systems.

Method used

A method for predicting karst spring flow based on a heterogeneous spatiotemporal graph attention network is constructed. By building a heterogeneous graph structure containing spatial edges, temporal edges, and edges spanning the same month across years, a two-layer graph attention mechanism is used to adaptively extract key feature vectors, and a weighted average pooling strategy is used for feature aggregation to achieve adaptive fusion of multi-relationship features.

🎯Benefits of technology

It significantly improves the accuracy and physical interpretability of karst spring flow prediction, enables dynamic assessment of the contribution of different hydrological relationships, and provides more accurate flow prediction results and hydrological process interpretation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122220985A_ABST
    Figure CN122220985A_ABST
Patent Text Reader

Abstract

The application discloses a karst spring flow prediction method and device based on a heterogeneous spatiotemporal graph attention network, relates to the technical field of geology, and comprises the following steps: S1, constructing an initial flow prediction model; S2, acquiring a training data set; S3, importing the training data set into the initial flow prediction model and training and optimizing the same to obtain an optimized flow prediction model; S4, acquiring input data to be predicted in real time; and S5, analyzing the input data to be predicted by using the optimized flow prediction model and predicting a predicted value of spring flow at the next moment. According to the method, the spatial hydrological relationship, the time-dependent process and the periodic recharge characteristics are uniformly represented by constructing a heterogeneous graph structure, and the independent modeling and adaptive fusion of multiple relationship characteristics are realized by using a double-layer graph attention mechanism, so that the accuracy and the physical interpretability of karst spring flow prediction are significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of geological technology, and in particular to a method and apparatus for predicting karst spring flow based on heterogeneous spatiotemporal graph attention networks. Background Technology

[0002] Karst landforms are unique geological landscapes formed by the erosion of soluble carbonate rocks. Their underground structure comprises fissures, caves, underground rivers, and conduit networks, exhibiting significant spatial heterogeneity and a highly developed three-dimensional seepage system. Carbonate rocks cover approximately 15% of the global land surface, and these areas contain abundant groundwater resources, serving as a vital source of freshwater for approximately 678 million people for domestic and industrial use. Karst springs are natural outlets for karst groundwater to emerge to the surface under pressure, and their flow dynamics directly reflect the recharge, runoff, and discharge characteristics of the karst aquifer system. The variation patterns of spring flow can directly reflect the coupling effect of rainfall-runoff-discharge processes and can be used to assess the impact of climate change and human activities on regional water resources. However, under the dual pressures of climate change and intensified human activities, groundwater levels in many karst areas are continuously declining, leading to reduced karst spring flows, and some springs even facing the risk of drying up, seriously threatening regional water security and ecological balance. Accurate prediction of karst spring flow is of great significance for the sustainable development and utilization of groundwater resources in karst areas.

[0003] Karst aquifers are naturally characterized by complex structures, heterogeneous media, significant differences in channel development, and diverse recharge methods. The dynamic evolution of spring flow often exhibits strong nonlinearity and multi-scale characteristics, making spring flow prediction a long-standing challenge in hydrogeology. In karst hydrological systems, rainfall input not only varies significantly spatially, but the contribution of rainfall to spring flow also differs across regions, closely related to factors such as topography, geological structure, and recharge pathways. Temporally, there is typically a 4-6 month lag between rainfall and spring flow, reflecting the water storage and migration processes of the underground aquifer system. Periodically, both rainfall and spring flow are controlled by monsoon climates, exhibiting clear interannual cycles. Therefore, spring flow prediction is essentially a complex coupling problem involving spatial heterogeneity, temporal dependence, and periodic regularity; the importance of different relationships to the prediction results dynamically changes with time and input conditions.

[0004] Research on karst hydrological processes primarily relies on physical mechanisms and numerical simulation techniques. Traditional hydrological models are constructed based on physical mechanisms, mathematically representing aquifer structure and flow processes. However, due to the strong spatial heterogeneity and complex coupling processes of karst systems, these traditional models depend on extensive parameter calibration and structural assumptions. The complex underground structures of karst regions are often difficult to fully characterize with limited geological data. The uncertainty of input data, the spatial abruptness of geological conditions, and the unobservability of underground water-conducting structures pose numerous challenges to traditional physical models in parameter acquisition and model construction. These models, limited by parameter uncertainties and structural assumptions, struggle to fully capture the system's strongly nonlinear response characteristics, and their simulation capabilities under highly heterogeneous conditions are restricted, thus affecting the accuracy of spring flow simulation and prediction.

[0005] With the development of data-driven methods, machine learning technology has been introduced into the field of hydrological forecasting. Its data-driven nonlinear mapping capabilities provide a new technical approach for karst spring flow prediction. Models such as random forests, support vector machines, and backpropagation neural networks can learn the relationship between inputs and outputs through training without requiring strict assumptions about physical mechanisms. This data-driven approach avoids the complex process of determining physical parameters, providing a new technical means for hydrological forecasting. However, traditional machine learning models rely on manual feature extraction and typically require a large number of high-quality training samples. In practical applications, these models struggle to automatically learn deep structural information from large amounts of raw data, exhibiting significant limitations in capturing long-term dependencies, deep structural features, and the expression of multivariate coupling relationships in time-series data.

[0006] The formation of karst spring flow is a complex, multi-source, and multi-scale process. Its dynamics are driven by short-term rainfall events and significantly influenced by seasonal climate change and interannual cycle patterns. Furthermore, the uneven spatial distribution of precipitation leads to varying contributions of different regions to the total spring flow. However, existing research indicates a theoretical and methodological gap in uniformly representing spatial dependencies, short-term dynamics, and long-term periodicity within a unified framework; existing single models struggle to comprehensively characterize this complex coupling problem. The importance of different relationships to prediction results also dynamically changes with time and input conditions, and existing deep learning methods are insufficient in dynamically selecting important features based on data and adaptively focusing on key influencing factors. Moreover, most existing models employ a single feature extraction strategy, failing to fully consider the differentiated contributions of different types of relationships to the prediction task. Traditional methods often use fixed weights or simple averaging when fusing multiple relationship features, failing to dynamically evaluate the contribution weights of different relationships based on the inherent patterns of the data, which to some extent limits the model's adaptability and prediction accuracy. Summary of the Invention

[0007] The purpose of this invention is to design a method and device for predicting karst spring flow based on heterogeneous spatiotemporal graph attention networks in order to solve the above problems.

[0008] The present invention achieves the above objectives through the following technical solutions:

[0009] A method for predicting karst spring flow based on heterogeneous spatiotemporal graph attention networks includes:

[0010] S1. Construct the initial flow prediction model, which includes a spatiotemporal modeling module, a two-layer graph attention mechanism, and a graph aggregation module. The spatiotemporal modeling module is used to construct a heterogeneous graph structure containing spatial edges, temporal edges, and edges spanning the same month across years based on the input data. The two-layer graph attention mechanism is used to adaptively extract key feature vectors from the multidimensional hydrological relationships contained in the heterogeneous graph structure. The graph aggregation module aggregates the key feature vectors using a weighted average pooling strategy and predicts the output value of the spring flow at the next moment.

[0011] S2. Obtain the training dataset;

[0012] S3. Import the initial traffic prediction model into the training dataset, and train and optimize it to obtain the optimized traffic prediction model.

[0013] S4. Real-time acquisition of the input data to be predicted;

[0014] S5. Analyze the input data to be predicted using the optimized flow prediction model, and predict the flow rate of the spring at the next moment.

[0015] A karst spring flow prediction device based on heterogeneous spatiotemporal graph attention network includes:

[0016] Storage; storage is used to store computer programs;

[0017] An actuator; the actuator is used to execute a computer program stored in a memory, which, when executed, implements the karst spring flow prediction method based on a heterogeneous spatiotemporal graph attention network as described above.

[0018] The beneficial effects of this invention are as follows: This method constructs a heterogeneous graph structure to uniformly represent spatial hydrological relationships, time-dependent processes, and periodic replenishment characteristics, and utilizes a two-layer graph attention mechanism to achieve independent modeling and adaptive fusion of multiple relationship features, thereby significantly improving the accuracy and physical interpretability of karst spring flow prediction. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the flow prediction model of the karst spring flow prediction method based on heterogeneous spatiotemporal graph attention network of the present invention;

[0020] Figure 2 This is a visualization of the predicted and actual values ​​of the traffic prediction model of this invention during the training, validation, and testing phases.

[0021] Figure 3 This is a visualization of the spatial channel attention results;

[0022] Figure 4 This is a visualization of the temporal channel attention results;

[0023] The corresponding figure labels are:

[0024] Figure 1 (a) is the input data for the flow prediction model; (b) is the heterogeneous graph structure constructed by the spatiotemporal modeling module; (c) is the two-layer graph attention mechanism; and (d) is the graph aggregation module, which obtains the spring flow prediction results for the next time period. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0026] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0027] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0028] In the description of this invention, it should be understood that the terms "upper," "lower," "inner," "outer," "left," "right," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this invention is in use, or the orientation or positional relationship commonly understood by those skilled in the art. They are only used to facilitate the description of this invention and to simplify the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.

[0029] Furthermore, the terms "first," "second," etc., are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0030] In the description of this invention, it should also be noted that, unless otherwise explicitly specified and limited, terms such as "set" and "connection" should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be a connection within two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0031] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0032] A method for predicting karst spring flow based on heterogeneous spatiotemporal graph attention networks includes:

[0033] S1. Construct the initial traffic prediction model, such as Figure 1 As shown, the traffic prediction model includes a spatiotemporal modeling module, a two-layer graph attention mechanism, and a graph aggregation module;

[0034] The spatiotemporal modeling module is used to construct a heterogeneous graph structure G(V, E) based on the input data, which includes spatial edges, temporal edges, and edges spanning the same month across years. Here, V is the set of nodes, and E is the set of edges. The node set V contains the observation values ​​of all observation stations at different times, and the node set V includes N×T+N×T×K nodes. ,node The node index of the heterogeneous graph structure G(V,E) is given by s, where s represents the observation station, t is the time, N is the total number of observation stations, T is the total number of observation times, and K is the Kth year prior. The input data includes recent data and data from the same period in previous years. The recent data is the data within a preset time range prior to the current time. This enables the integration of hydrological information at multiple time scales in the prediction task. The spatiotemporal modeling module can simultaneously utilize spatial hydrological relationships, temporal dependencies, and hydrological periodic patterns in the prediction task, greatly improving the feature extraction capability of the flow prediction model for karst hydrological systems. In practice, three different types of edges are connected to the corresponding nodes. Since there is no information loss or relationship conflict problem in the construction of heterogeneous graphs, no additional graph simplification processing is required.

[0035] A two-layer graph attention mechanism is used to adaptively extract key feature vectors from the multidimensional hydrological relationships inherent in heterogeneous graph structures. Specifically, the two-layer graph attention mechanism performs node-level analysis and channel-level analysis on the heterogeneous graph structure sequentially. The node-level analysis constructs independent computational channels for the three relationship types. The graph attention mechanism independently learns the importance weights of neighboring nodes in each channel and aggregates features to generate an intermediate representation from the perspective of that channel. The three channels are the spatial channel φs, the temporal channel φt, and the periodic channel φc. The channel-level analysis dynamically evaluates the relative importance of the three channels through the attention mechanism, calculates the contribution weight of each channel, and performs weighted fusion of the three intermediate representations to obtain the key feature vectors of the nodes.

[0036] Node-level analysis analyzes each channel, specifically including:

[0037] (1) Assume a recent observation node serving as the computation center is denoted as i, and the input feature vector is denoted as i. ,in For feature dimensions;

[0038] (2) Calculate the importance weights between node i and node j in channel φ using the graph attention mechanism. , is represented as: Where φ∈{φs, φt, φc}, ∈Rᵈ'ˣᵈ is a linear transformation matrix specific to channel φ, responsible for projecting node features from d-dimensional space to d'-dimensional space; It is the trainable attention parameter vector for that channel. ∠represents the transpose operation, ‖ represents the vector concatenation operation, and ReLU is a non-linear activation function. For nodes In the passage The set of neighboring nodes, and For the index of the neighboring nodes in this set, Neighboring nodes The input feature vector;

[0039] (3) Weight the input feature vector based on importance Perform feature aggregation to obtain the intermediate representation of node i under channel φ. ∈Rᵈ', represented as: , zᵢᵠ∈Rᵈ' is the d'-dimensional intermediate representation of node i under channel φ. Let i be the set of neighboring nodes of node i;

[0040] Channel-level analysis analyzes each channel, specifically including:

[0041] 1) Assume the set of recently observed nodes is denoted as Vᵣ, and the set Vᵣ is the node set. A subset containing all recent data nodes, numbering T×N, with all channels sharing learnable parameters including the query vector q and the semantic transformation matrix. and the bias vector of semantic transformation N is the total number of observation stations, and T is the total number of observation times;

[0042] 2) Dynamically assess the relative importance of channel φ through an attention mechanism and calculate the contribution weight of channel φ. , is represented as: ,in, Represents the query vector Transpose of; It is the hyperbolic tangent activation function; For the natural constant An exponential function with base 0; For channel traversal variables, For nodes In the passage The middle part below;

[0043] 3) Based on contribution weight Intermediate representation of three channels We perform weighted fusion to obtain the key feature vector of node i. , represented as ;

[0044] The graph aggregation module aggregates key feature vectors using a weighted average pooling strategy and predicts the next time step's spring flow rate. Specifically:

[0045] ① The graph aggregation module aggregates key feature vectors using a weighted average pooling strategy. Obtain graph-level representation ∈Rᵈ', represented as: Where Vᵣ represents the set of recently observed nodes, Let i be the key feature vector of node i. Let be the learnable weight parameters corresponding to node i;

[0046] ② A multilayer perceptron is used to perform a nonlinear transformation on the graph-level representation hᴳ, and the predicted value of the spring water flow at the next time step is output. , is represented as: ,in, b is the weight matrix of the output layer; o ∈R is the bias parameter. This is the weight matrix of the intermediate hidden layer. This is the bias vector for the output layer. This represents the dimension of the intermediate hidden layer.

[0047] S2. Obtain the training dataset.

[0048] S3. Import the initial traffic prediction model into the training dataset, and train and optimize it to obtain the optimized traffic prediction model.

[0049] S4. Acquire the input data to be predicted in real time.

[0050] S5. Analyze the input data to be predicted using the optimized flow prediction model, and predict the flow rate of the spring at the next moment.

[0051] The two-layer graph attention mechanism adaptively extracts key features from the multidimensional hydrological relationships inherent in heterogeneous graphs and dynamically adjusts the importance of different relationships during the training of the flow prediction model. This accurately assesses the contribution of different hydrological relationships to the prediction task, thereby enhancing the impact of key information on the flow prediction model training process. At the node level, after obtaining the importance of different relationships through the attention mechanism, appropriate methods can be adopted to adjust the feature learning of the network model. During the training of the flow prediction model, a graph attention mechanism is added to each computational channel, which automatically assigns weights to neighboring nodes. This allows key nodes to have a greater impact on the flow prediction model during feature aggregation, counteracting the influence of noisy nodes. Consequently, the feature representation learned by the flow prediction model more accurately reflects the true state of the hydrological system. Channel-level analysis learns the contribution weight of each channel. To dynamically adjust the contribution of different hydrological relationships in the final node representation;

[0052] The two-layer graph attention mechanism unifies node-level and channel-level attention mechanisms into a two-layer attention framework. This means that while considering the impact of differences in node importance on network model training, it comprehensively evaluates the contribution of different hydrological relationships to the prediction task. Through this mechanism, the flow prediction model can dynamically adjust its approach based on the inherent patterns in the data, adjusting whether to rely more on spatial relationships between stations, temporal dependencies in observation sequences, or periodic patterns across different years in the current prediction step. This achieves adaptive fusion of different hydrological relationships, improving the performance of the flow prediction model. This process can iterate through multiple layers, allowing each recent observation node to gradually aggregate a wider range of neighboring hydrological information, ultimately forming a complete representation vector matrix Z containing all recent observation nodes.

[0053] The core of the graph aggregation module is to consider that the contribution weights of different observation nodes to the overall hydrological state should be different. That is, key observation stations should have a greater influence when aggregating graph representations. In contrast, flow prediction models assign equal importance to all nodes during the prediction process, failing to highlight the role of key stations. The graph aggregation module considers the differences in node importance when generating graph-level representations. Each node is weighted during the aggregation process based on its learnable weight parameters, ensuring that key nodes contribute more to the graph representation and are given relatively larger weights. Conversely, less important nodes are given relatively smaller weights during aggregation. This allows the flow prediction model to adaptively learn the contribution levels of different nodes to the overall hydrological state, thereby highlighting information from key observation stations and suppressing less important information. Subsequently, a multilayer perceptron is used to more accurately capture the complex nonlinear relationship between the graph representation and the prediction target.

[0054] A karst spring flow prediction device based on heterogeneous spatiotemporal graph attention network includes:

[0055] Storage; storage is used to store computer programs;

[0056] An actuator; the actuator is used to execute a computer program stored in a memory, which, when executed, implements the karst spring flow prediction method based on a heterogeneous spatiotemporal graph attention network as described above.

[0057] This method constructs a heterogeneous graph structure containing spatial edges, temporal edges, and cross-year / monthly edges, which is fundamentally different from traditional methods. Traditional time-series models such as LSTM only organize observational data into time series form, and can only model the temporal dimension of dependencies, failing to represent spatial heterogeneity. Although traditional GNN models introduce graph structures to represent spatial relationships, they usually only construct a single type of spatial connection edge, ignoring temporal dependencies and periodic patterns. In contrast, this method embeds recent observational data and historical data from the same period as nodes into a unified graph structure. Spatial edges connect nodes at different stations at the same time to represent the spatial distribution characteristics of precipitation; temporal edges connect nodes at the same station for consecutive months to represent the lag response process of precipitation-spring flow; and cross-year / monthly edges connect recent nodes with historical nodes from the same period to represent interannual periodic patterns. Thus, it achieves a coordinated expression of spatial, temporal, and periodic hydrological relationships within a unified graph structure framework, which is impossible with traditional methods.

[0058] This method proposes a two-layer graph attention mechanism, which differs significantly from traditional feature fusion methods. Traditional methods typically employ simple concatenation, fixed-weight addition, or average pooling when fusing multi-source features, failing to dynamically adjust the contribution weights of different features based on the inherent patterns in the data. Our two-layer attention mechanism first constructs independent computational channels at the node level for each of the three relationship types. Within each channel, the graph attention mechanism independently learns the importance weights of neighboring nodes and aggregates features to generate an intermediate representation from that relationship's perspective. This allows the model to capture spatial hydrological connections, temporal process memory, and periodic variation patterns separately, avoiding mutual interference between features from different relationships. Subsequently, at the channel level, the model dynamically evaluates the relative importance of the three channels through the attention mechanism, calculates the contribution weight of each channel, and performs a weighted fusion of the three intermediate representations to obtain the final node representation. This two-layer attention strategy of "independent modeling within relationships and dynamic fusion between relationships" enables the model to adaptively adjust its dependence on spatial, temporal, and periodic relationships according to the needs of the current prediction task, thereby significantly improving the flexibility of feature extraction and prediction accuracy.

[0059] This method proposes a collaborative configuration strategy of time window and historical backtesting period to address the multi-timescale characteristics of karst hydrological systems. Traditional time series models typically only consider recent historical sequences of fixed length as input, making it difficult to simultaneously capture short-term fluctuations and long-term cycles. This method determines the length of recent continuous observation sequences by setting a time window parameter T, and determines the number of years of historical data from the same period by setting a historical backtesting period parameter K. These two parameters work together to simultaneously model short-term dynamics and long-term cycles. Experiments show that when T is set to 12 months (a complete hydrological year) and K is set to 5 years, the model achieves the best balance between capturing interannual cycle variations and avoiding information redundancy, resulting in optimal predictive performance. This parameterized modeling strategy for multi-timescale characteristics is not available in traditional single-timescale models.

[0060] This method achieves automatic identification and visualization of the watershed recharge mechanism through the spatial channel attention weight distribution, which is fundamentally different from traditional black-box models. While traditional deep learning models may have high prediction accuracy, their internal decision-making processes are difficult to interpret, failing to reveal the physical mechanisms of hydrological processes. This method, by analyzing the spatial attention weights learned by the model, can quantify the contribution of precipitation at different monitoring stations to spring flow, thereby identifying the main recharge areas. Experimental results show that the spatial weight distribution automatically learned by the model is highly consistent with the actual hydrogeological mechanism of the Shentouquan watershed, which is "primarily recharged from distant sources and supplemented by recharge from nearby sources." The highest attention weights are obtained in high-altitude karst development areas such as Ningwu and Shenchi, while the weights at basin edge stations are relatively low. This physical consistency verifies the interpretability and reliability of the model, providing a scientific basis for watershed water resources management.

[0061] This method reveals the lag response pattern of precipitation-spring flow by varying the attention weights over time, providing dynamic response characteristics that are difficult to obtain using traditional statistical methods. While traditional statistical methods such as cross-covariance analysis can calculate the overall lag correlation, they cannot characterize the dynamic changes in this lag relationship. The time attention mechanism of this method can learn the relative contribution of precipitation events at different time steps to the current spring flow. Experimental results show that the current spring flow is mainly influenced by precipitation events from 4 to 6 months ago, with the attention weights reaching their peak during this lag period. This is consistent with the results of cross-covariance analysis, further validating the model's effectiveness in capturing time dependencies. More importantly, this attention-based time modeling method can adaptively learn the differences in lag responses across different seasons and years, providing a more refined characterization of the "storage-release" mechanism of karst aquifer systems.

[0062] This embodiment demonstrates the effectiveness of the proposed method and the necessity of each component through comparative and ablation experiments. In the Shentouquan flow prediction task, the H-STGAT model achieved a Nash efficiency coefficient of 0.7695, a root mean square error of 0.2261 cubic meters per second, a mean absolute error of 0.1692 cubic meters per second, and a mean absolute percentage error of 3.81%. Its overall performance significantly outperformed comparative models such as the autoregressive moving average model, the multiple linear regression model, recurrent neural networks, long short-term memory networks, graph convolutional networks, and graph attention networks. Ablation experiments show that removing periodic patterns, spatial relationships, temporal dependencies, and channel-level attention mechanisms reduced the Nash efficiency coefficient by 37.7%, 16.3%, 7.0%, and 5.0%, respectively, validating the necessity and synergistic effect of the three types of hydrological relationships and the two-layer attention mechanism. Multi-step prediction experiments demonstrate that the model maintains stable and excellent prediction accuracy within a 1-6 month prediction range, possessing good long-term prediction capabilities and providing reliable decision support for groundwater resource management in karst areas.

[0063] Example 1, such as Figure 2 , Figure 3 , Figure 4 As shown;

[0064] The dataset used in this embodiment comes from the Shentouquan watershed in Shanxi Province, covering 63 years of monthly hydrological observation data from January 1958 to December 2020. The dataset includes monthly precipitation data from 10 precipitation observation stations within the watershed (Kelan, Ningwu, Pianguan, Shanyin, Shenchi, Shuozhou, Yingxian, Youyu, Zuoyun, and Pinglu) and monthly flow data from Shentouquan. From a temporal perspective, this embodiment divides the data into three sets based on its time-series characteristics: 39 years from 1958 to 1996 (training set), 12 years from 1997 to 2008 (validation set), and 12 years from 2009 to 2020 (test set). After training the model using the proposed heterogeneous spatiotemporal graph attention network method, this embodiment compares and validates the flow prediction model with various traditional statistical models and deep learning baseline models, and statistically calculates relevant indicators.

[0065] To more concretely demonstrate the model's predictive performance, this embodiment records the comparison between the H-STGAT model's predictions and actual observations over the entire time period. It can be seen that the overall trend of the model's predictions and actual observations is highly consistent, and the model can accurately capture the seasonal fluctuations and long-term trends of spring flow. During the training, validation, and testing periods, the predicted values ​​consistently follow the changes in actual observations well. Although there are some deviations in certain local periods, the overall fitting effect is good. The R² values ​​for the training, validation, and testing sets reach 0.97, 0.78, and 0.77, respectively, with the scatter plots closely clustered near the zero error line and a narrow 95% confidence interval, indicating that the model has good generalization ability and predictive stability. To evaluate the model's long-term predictive ability, this embodiment conducts multi-step prediction experiments on the test set for periods ranging from 1 to 6 months. The experimental results show that for short-term predictions of 1 to 3 months, the Nash efficiency coefficient consistently remains above 0.70, and the Nash efficiency coefficient for 1-month predictions reaches 0.77. When the forecast period was extended to 6 months, the Nash efficiency coefficient dropped to 0.67, but the model still maintained its ability to accurately predict the trend of spring flow changes, demonstrating good long-term forecast stability.

[0066] To verify the necessity and effectiveness of the key technical components proposed in this method, detailed ablation experiments were conducted in this embodiment. The experiments removed spatial hydrological relationships, time-dependent processes, periodic patterns, and channel-level attention mechanisms, respectively, and observed the changes in model performance. The results show that removing periodic patterns led to a 37.7% decrease in the Nash efficiency coefficient to 0.4792, indicating that capturing interannual periodic variations is fundamental for accurate prediction. Removing spatial hydrological relationships led to a 16.3% decrease in the Nash efficiency coefficient to 0.6441, demonstrating the significant impact of spatial precipitation heterogeneity. Removing time-dependent processes led to a 7.0% decrease in the Nash efficiency coefficient to 0.7153, indicating the necessity of capturing the memory effect of hydrological processes. Removing the channel-level attention mechanism led to a 5.0% decrease in the Nash efficiency coefficient to 0.7312, verifying the effectiveness of the adaptive attention mechanism in multi-relation feature fusion. These ablation experimental results fully demonstrate the necessity of the three types of hydrological relationships and the two-layer attention mechanism in the heterogeneous graph structure.

[0067] This method automatically identifies the recharge mechanism of the Shentouquan watershed by analyzing the spatial channel attention weights learned by the model. Experimental results show that the model assigns the highest attention weights to Ningwu Station and Shenchi Station, at 0.24 and 0.22 respectively. These two stations are located in the high-altitude karst development area of ​​Guancen Mountain in the southwest of the watershed and are the core recharge area of ​​the watershed. The weights of Youyu Station and Zuoyun Station are 0.16 and 0.13 respectively, reflecting their transmission role in the regional groundwater flow path. The weights of Pinglu, Shuozhou, and Shanyin Stations range from 0.12 to 0.13, while the weights of Kelan Station and Yingxian Station are the lowest, at only 0.03 and 0.04 respectively. This spatial weight distribution pattern is highly consistent with the actual hydrogeological mechanism of the Shentouquan watershed, proving that the model can autonomously learn physically meaningful hydrological relationships from spatiotemporal data. This method reveals the hysteresis response law between precipitation and spring flow by analyzing the changes in attention weights in the time channel. Experimental results show that the current spring flow is mainly affected by precipitation events from about 4 to 6 months ago. The time attention weight reaches its peak during this lag period, exhibiting a significant six-month lag response characteristic, which is completely consistent with the results obtained from the cross-variance analysis. This fully demonstrates the model's ability to accurately characterize the physical laws of karst hydrological processes.

[0068] The technical solutions of the present invention are not limited to the specific embodiments described above. Any technical modifications made in accordance with the technical solutions of the present invention fall within the protection scope of the present invention.

Claims

1. A method for predicting karst spring flow rate based on heterogeneous spatiotemporal graph attention networks, characterized in that, include: S1. Construct the initial flow prediction model, which includes a spatiotemporal modeling module, a two-layer graph attention mechanism, and a graph aggregation module. The spatiotemporal modeling module is used to construct a heterogeneous graph structure containing spatial edges, temporal edges, and edges spanning the same month across years based on the input data. The two-layer graph attention mechanism is used to adaptively extract key feature vectors from the multidimensional hydrological relationships contained in the heterogeneous graph structure. The graph aggregation module aggregates the key feature vectors using a weighted average pooling strategy and predicts the output value of the spring flow at the next moment. S2. Obtain the training dataset; S3. Import the initial traffic prediction model into the training dataset, and train and optimize it to obtain the optimized traffic prediction model. S4. Acquire the input data to be predicted in real time; S5. Analyze the input data to be predicted using the optimized flow prediction model, and predict the flow rate of the spring at the next moment.

2. The karst spring flow prediction method based on heterogeneous spatiotemporal graph attention network according to claim 1, characterized in that, The input data is used by the spatiotemporal modeling module to combine the input data into a complete heterogeneous graph G(V, E), where V is the set of nodes and E is the set of edges. The node set V contains the observation values ​​of all observation stations at different times, and the node set V includes N×T+N×T×K nodes. ,node Let be the node index of the heterogeneous graph structure G(V,E), where s represents the observation station, t is the time, N is the total number of observation stations, T is the total number of observation times, and K is the Kth year in advance. The input data includes recent data and data from the same period in previous years. The recent data is the data within a preset time range in advance from the current time.

3. The karst spring flow prediction method based on heterogeneous spatiotemporal graph attention network according to claim 1, characterized in that, The two-layer graph attention mechanism performs node-level and channel-level analysis on the heterogeneous graph structure sequentially. The node-level analysis constructs independent computation channels for the three relation types. The graph attention mechanism is used to independently learn the importance weights of neighboring nodes in each channel and aggregate features to generate an intermediate representation from the perspective of that channel. The three channels are the spatial channel φs, the temporal channel φt, and the periodic channel φc. The channel-level analysis dynamically evaluates the relative importance of the three channels through the attention mechanism, calculates the contribution weight of each channel, and performs weighted fusion of the three intermediate representations to obtain the key feature vector of the node.

4. The karst spring flow prediction method based on heterogeneous spatiotemporal graph attention network according to claim 3, characterized in that, Node-level analysis analyzes each channel, specifically including: (1) Assume a recent observation node that serves as the computation center is denoted as i, and the input feature vector is denoted as hᵢ with dimension d; (2) Calculate the attention coefficient between node i and node j in channel φ using graph attention mechanism. , is represented as: Where φ∈{φs,φt,φc}, ∈Rᵈ'ˣᵈ is a channel-specific linear transformation matrix responsible for projecting node features from d-dimensional space to d'-dimensional space; aᵠ∈R²ᵈ' is the trainable attention parameter vector for this channel, ‖ denotes vector concatenation operation, and ReLU is a non-linear activation function. Let i be the set of neighboring nodes of node i; (3) Perform feature aggregation on the input feature vector based on the attention coefficient to obtain the intermediate representation of node i under channel φ. ∈Rᵈ', represented as: Where zᵢᵠ∈Rᵈ' is the d'-dimensional intermediate representation of node i under channel φ. Let i be the set of neighboring nodes of node i.

5. The karst spring flow prediction method based on heterogeneous spatiotemporal graph attention network according to claim 4, characterized in that, Channel-level analysis analyzes each channel, specifically including: 1) Assume the set of recently observed nodes is denoted as Vᵣ, and its size is T×N. The learnable parameters shared by all channels are the query vector q and the semantic transformation matrix. and the bias vector of semantic transformation N is the total number of observation stations, and T is the total number of observation times; 2) Dynamically assess the relative importance of channel φ through an attention mechanism and calculate the contribution weight of channel φ. , is represented as: ,in, Represents the query vector Transpose of; It is the hyperbolic tangent activation function; For the natural constant An exponential function with base 0; For channel traversal variables, For nodes In the passage The middle part below; 3) Based on contribution weight Intermediate representation of three channels We perform weighted fusion to obtain the key feature vector of node i. , represented as .

6. The karst spring flow prediction method based on heterogeneous spatiotemporal graph attention network according to claim 1, characterized in that, The graph aggregation module predicts the next moment's spring water flow rate as follows: ① The graph aggregation module aggregates key feature vectors using a weighted average pooling strategy. Obtain graph-level representation ∈Rᵈ', represented as: Where Vᵣ represents the set of recently observed nodes, Let i be the key feature vector of node i. Let be the learnable weight parameters corresponding to node i; ② A multilayer perceptron is used to perform a nonlinear transformation on the graph-level representation hᴳ, and the predicted value of the spring water flow at the next time step is output. , is represented as: ,in, b is the weight matrix of the output layer; o ∈R is the bias parameter. This is the weight matrix of the intermediate hidden layer. This is the bias vector for the output layer. This represents the dimension of the intermediate hidden layer.

7. A karst spring flow prediction device based on heterogeneous spatiotemporal graph attention network, characterized in that, include: Storage; Storage is used to store computer programs; Actuator; The actuator is used to execute a computer program stored in the memory, which, when executed, implements the karst spring flow prediction method based on heterogeneous spatiotemporal graph attention network as described in any one of claims 1-6.