A regional water quality prediction method and system
By performing modal decomposition and graph network coupling on water quality data, long-term and short-term spatiotemporal features are constructed, solving the error problem of traditional water quality prediction methods under spatiotemporal decoupling and realizing accurate prediction of regional water quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI ALLIWAY WATER ENVIRONMENT TECH CO LTD
- Filing Date
- 2026-04-08
- Publication Date
- 2026-07-10
AI Technical Summary
Traditional water quality prediction methods, due to their inherent limitations of spatiotemporal decoupling, cannot accurately reflect the spatial diffusion of regional water bodies, resulting in large prediction errors, especially in pollution events where their performance is significantly limited.
By performing modal decomposition on water quality data, long-term and short-term fluctuation features are extracted and coupled with a graph network structure to construct long-term and short-term spatiotemporal features, which are then fused for prediction.
It achieves accurate prediction of water quality data in time and space, taking into account the long-term fluctuations, short-term fluctuations and spatial variability of water quality data, and improves the accuracy of prediction results.
Smart Images

Figure CN122365347A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of water environment monitoring and water quality prediction technology, and specifically to a regional water quality prediction method and system. Background Technology
[0002] Current water environment monitoring systems are undergoing a technological transformation from discrete sampling to continuous sensing, with the core technology lying in constructing spatiotemporal coupling characteristics using water quality parameters. However, establishing spatiotemporal coupling characteristics remains a challenge for water environment monitoring, given the dynamic nature of regional water bodies. At the temporal evolution level, this dynamic nature stems from the interaction of three driving mechanisms: seasonal cyclical fluctuations, trend-based accumulation processes, and sudden disturbance events. Spatially, water quality correlations between monitoring nodes within a watershed system are dominated by hydrological connectivity, specifically manifested as the cascading effects of upstream pollution source migration and diffusion through hydrodynamic networks. This complex spatiotemporal interweaving necessitates that pollutant source tracing and propagation simulations simultaneously consider both lateral spatial transmission effects and longitudinal temporal accumulation processes. The core challenge currently lies in accurately characterizing the impact mechanism of spatiotemporal heterogeneity on prediction accuracy. On one hand, pollutant migration rates are influenced by hydrological conditions; on the other hand, sudden pollution events can disrupt the steady-state assumptions of spatiotemporal correlations.
[0003] Traditional water quality prediction methods face inherent limitations due to spatiotemporal decoupling, resulting in predictions that can only reflect short-term results from a single or a small number of detection sites. They cannot provide accurate results for situations involving spatial diffusion. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a regional water quality prediction method and system. The method involves decomposing the acquired data based on long-term trends and short-term variations, constructing corresponding feature models for each trend and variation to obtain relevant spatiotemporal and spatial distribution results, and combining these two distributions to obtain a prediction result that considers both temporal and spatial influences. To achieve the above objectives, the technical solution adopted by this invention is as follows:
[0005] Firstly, a regional water quality prediction method is provided. The method includes: performing mode decomposition on the time-series data corresponding to each detection node within a unit time in the detection area to obtain low-frequency and high-frequency components corresponding to each detection data, and constructing low-frequency component data sequences and high-frequency component data sequences; extracting long-term fluctuation features and short-term fluctuation features corresponding to the low-frequency component data sequences and the high-frequency component data sequences respectively, and coupling the long-term fluctuation features and the short-term fluctuation features with a pre-constructed graph network structure to obtain long-spatial-temporal features and short-spatial-temporal features respectively; constructing the graph network structure based on each detection node as a graph node and having a graph node connection relationship; fusing the long-spatial-temporal features and the short-spatial-temporal features to obtain fused features, and obtaining multi-parameter prediction sequences for each detection node within a future time step based on the fused features.
[0006] In some specific implementations, modal decomposition of the time-series data includes: decomposing the modal components of each detected data based on initial parameters and determining the initial minimum envelope entropy value corresponding to each set of parameters after decomposition; updating the initial parameters multiple times based on a preset number of updates to obtain corresponding update parameters, and decomposing the modal components of each detected data based on each update parameter, selecting and determining the decomposition parameters corresponding to the minimum envelope entropy value after multiple decompositions as target decomposition parameters, and performing modal decomposition of the multivariate time-series data based on the target decomposition parameters.
[0007] In some specific implementations, extracting the long-term fluctuation features of the low-frequency component data includes: obtaining the hidden state matrix of multiple low-frequency components at each time step, transforming each hidden state to generate a time pattern feature with a time relationship, obtaining the correlation between each hidden state and the time pattern feature, updating the time pattern feature based on the correlation to generate a context vector, and fusing the context vector with the current hidden state to obtain the hidden state, wherein the hidden state is the time feature.
[0008] In some specific implementations, each hidden state is transformed to generate a temporal pattern feature with a temporal relationship, including: performing convolution processing along the row vectors of the hidden state matrix based on the convolution kernel to obtain a temporal pattern matrix, wherein each row of the temporal pattern matrix corresponds to a temporal feature pattern of a variable.
[0009] In some specific implementations, extracting the short-term fluctuation features of the high-frequency component data includes: padding the high-frequency component data to obtain target high-frequency component data; extracting multiple local features of the target high-frequency component data; updating the multiple local features based on preset feature distribution requirements to obtain multiple updated local features; obtaining attention weights corresponding to the multiple updated local features; and performing weighted fusion of the multiple updated local features based on the attention weights to obtain the short-term fluctuation features.
[0010] In some specific implementations, constructing a graph network structure based on each of the detection nodes includes: obtaining the spatial positional relationship between each of the detection nodes, constructing a topology structure corresponding to multiple detection nodes based on the distribution requirements of the spatial positional relationship, and constructing an initial adjacency matrix based on the detection data corresponding to the associated detection nodes on the topology structure.
[0011] In some specific implementations, the spatial location relationship is the geographical distance between each detection node. Based on the distribution requirements of the spatial location relationship, a topology structure corresponding to multiple detection nodes is constructed, including: filtering multiple geographical distances according to a distance threshold and retaining only multiple target geographical distances that meet the threshold requirements; determining two associated detection nodes corresponding to each target geographical distance to form an associated detection node pair; and generating a static graph and an initial adjacency matrix corresponding to the static graph based on the geographical distances corresponding to multiple associated detection nodes.
[0012] In some specific implementations, the long-term fluctuation features and the short-term fluctuation features are coupled with the constructed graph network structure, including: obtaining an embedding matrix by linear transformation of the initial adjacency matrix; expanding the embedding matrix based on the time dimension of the time-series multivariate data and copying it according to batch size to obtain a spatial location embedding matrix; combining the long-term fluctuation features and the short-term fluctuation features with the spatial location embedding matrix to obtain long-term fluctuation update features and short-term fluctuation update features; and updating the long-term fluctuation update features and short-term fluctuation update features based on self-attention to obtain coupled long-term spatiotemporal features and short-term spatiotemporal features.
[0013] In some specific implementations, the long-term fluctuation update features and the short-term fluctuation update features are updated based on self-attention, including: generating query vectors, key vectors and value vectors corresponding to the long-term fluctuation update features and the short-term fluctuation update features, obtaining attention weights based on the query vectors, the key vectors and the value vectors, and updating the long-term fluctuation features and the short-term fluctuation features based on the attention weights.
[0014] Secondly, a regional water quality prediction system is provided, comprising multiple detection nodes and a processing terminal set up within a detection area, each detection node being used to acquire detection data within a sub-area; each detection node is equipped with multiple data acquisition units and data transmission units; each data acquisition unit is equipped with multiple data acquisition devices for acquiring multiple water quality-related detection data within the sub-area, and the data transmission unit is used to transmit the multiple detection data to the processing terminal, the processing terminal being used to execute the regional water quality prediction method described in any one of the above claims, the processing terminal comprising:
[0015] The data decomposition device is used to perform modal decomposition on the multivariate time-series data corresponding to each detection node in the detection area per unit time, to obtain the low-frequency and high-frequency components corresponding to each detection data, and to construct multivariate low-frequency component data and multivariate high-frequency component data.
[0016] The feature extraction device is used to extract the long-term fluctuation features and short-term fluctuation features corresponding to the low-frequency component data sequence and the high-frequency component data sequence, respectively, and couple the long-term fluctuation features and the short-term fluctuation features with the constructed graph network structure to obtain long-term spatiotemporal features and short-term spatiotemporal features.
[0017] A prediction device is used to fuse the long-term fluctuation features and the short-term fluctuation features to obtain fused features, and to obtain multi-parameter prediction sequences for each of the detection nodes in future time steps based on the fused features.
[0018] In the technical solution provided by this application embodiment, modal decomposition is performed based on the frequency distribution characteristics of water quality monitoring data. Temporal features are extracted from the decomposed modal components, and these temporal features are coupled through an adaptively updated graph network structure. This combines temporal and spatial features to obtain spatiotemporal features. Finally, the spatiotemporal features of two different moduli are fused to obtain the prediction result. Compared to existing technologies, this application embodiment starts from the characteristics of water quality data, taking into account its long-term fluctuations, short-term fluctuations, and spatial variability. It extracts features multiple times and optimizes temporal and spatial features, ultimately obtaining a fused feature that reflects the spatiotemporal distribution of water quality data. Based on this fused feature, the accuracy of regional water quality prediction results is achieved. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] The methods, systems, and / or procedures shown in the accompanying drawings will be further described with reference to exemplary embodiments. These exemplary embodiments will be described in detail with reference to the drawings. These exemplary embodiments are non-limiting exemplary embodiments, wherein example figures represent similar mechanisms in the various views of the drawings.
[0021] Figure 1 This is a schematic diagram of the regional water quality prediction system provided in the embodiments of this application.
[0022] Figure 2 This is a schematic diagram of the regional water quality prediction method provided in the embodiments of this application.
[0023] Figure 3 This is a schematic diagram of the server structure provided in an embodiment of this application.
[0024] Figure 4 This is a schematic diagram of the terminal device structure provided in the embodiments of this application. Detailed Implementation
[0025] To better understand the above technical solutions, the technical solutions of this application will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the embodiments of this application and the specific features in the embodiments are detailed descriptions of the technical solutions of this application, rather than limitations on the technical solutions of this application. In the absence of conflict, the embodiments of this application and the technical features in the embodiments can be combined with each other.
[0026] In the detailed description below, numerous specific details are illustrated with examples to provide a comprehensive understanding of the relevant guidance. However, it will be apparent to those skilled in the art that this application can be practiced without these details. In other instances, well-known methods, procedures, systems, components, and / or circuits have been described at a relatively high level without detail to avoid unnecessarily obscuring aspects of this application.
[0027] This application uses flowcharts to illustrate the execution process performed by a system according to embodiments of this application. It should be clearly understood that the execution processes in the flowcharts may not be executed sequentially. Instead, these execution processes may be executed in reverse order or simultaneously. Additionally, at least one other execution process may be added to the flowchart. One or more execution processes may be deleted from the flowchart.
[0028] Before providing a further detailed description of the embodiments of the present invention, the nouns and terms involved in the embodiments of the present invention will be explained, and the nouns and terms involved in the embodiments of the present invention shall be interpreted as follows.
[0029] (1) In response to, used to indicate the conditions or states on which the operation is performed depends. When the conditions or states on which the operation is performed are met, one or more operations may be performed in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations are performed.
[0030] (2) Based on, used to indicate the conditions or states on which the operation is performed depends. When the conditions or states on which it depends are met, one or more operations can be performed in real time or with a set delay. Unless otherwise specified, there is no restriction on the order of execution of the multiple operations.
[0031] With the widespread application of IoT technology in environmental monitoring, watershed water quality monitoring is undergoing a paradigm shift from discrete-point monitoring to intelligent sensing systems. However, traditional static network models struggle to effectively characterize the spatiotemporal correlations of dynamic coupling among multiple stations within a watershed, resulting in problems such as low pollution detection accuracy and poor early warning timeliness. In water quality monitoring networks, the dynamic construction of spatiotemporally dependent systems is of paramount importance for achieving real-time water quality monitoring and pollution source tracing.
[0032] Traditional water quality prediction methods face inherent limitations due to their spatiotemporal decoupling. While time-series models, such as autoregressive moving average models and long short-term memory networks, can capture local temporal dependencies, they struggle to model spatial topological constraints between monitoring stations. This neglect of spatial interaction mechanisms leads to error propagation amplification in regional-scale predictions, significantly limiting their performance, especially when dealing with pollution plume migration scenarios.
[0033] Therefore, in view of this technical background, in order to realize the water quality detection and prediction of regional water bodies with dynamic changes, a water quality detection system based on Internet of Things technology is provided. By collecting multiple detection data from multiple detection nodes in a region within a unit of time, and by constructing a temporal and spatial coupling relationship between multiple detection data, the temporal-spatial relationship of water quality changes is realized. Based on this relationship, the trend of water quality data change is obtained more completely, and the water quality prediction results of each detection node corresponding to the next time step are obtained based on this trend.
[0034] Water quality data is a core indicator characterizing the quality of aquatic environments, and its dynamic changes can effectively reflect the health status and evolution trend of regional aquatic ecosystems. However, complex coupling relationships often exist between different water quality indicators, and the change of a single parameter may trigger multi-dimensional chain responses. To deeply analyze the inherent correlation characteristics of water quality data, this embodiment uses Pearson correlation coefficient to perform time-series correlation analysis on multiple key water indicators, obtaining six final water body data: temperature, pH, dissolved oxygen, conductivity, permanganate index, and total nitrogen. It can be understood that the detection data obtained in this embodiment is the aforementioned water body data, and the final prediction results are also based on the aforementioned water body data. The method for screening key water indicators using Pearson correlation coefficient can employ existing technologies and will not be elaborated upon in this embodiment.
[0035] Specifically, the regional water quality prediction system in this application embodiment is constructed using an Internet of Things (IoT) architecture. For details, please refer to... Figure 1 The water quality prediction system 10 for this area includes multiple detection nodes 11, each equipped with multiple data acquisition devices 111 and an intermediate device 112. Each data acquisition device is used to acquire one type of water body data. As described above, the water body data acquired in this embodiment includes six water body data points, and therefore, six data acquisition devices are configured to acquire each of these water body data points. The data acquisition devices can utilize existing sensors corresponding to the water body data, which will not be elaborated upon in this embodiment. The intermediate device is connected to the multiple data acquisition devices via communication lines and is used to store the water body data acquired at each time step.
[0036] Furthermore, the regional water quality prediction system in this embodiment also includes a data transmission unit, wherein the data transmission unit 12 wirelessly communicates with the intermediate device corresponding to each detection node. The intermediate device packages the water data stored at each detection node based on a preset time period and transmits it to the server 13 via the data transmission unit.
[0037] In this embodiment, the server is the main device for processing water body data. The server is used to execute the regional water quality prediction method provided in this embodiment, and to process multiple water body data collected from multiple detection nodes and multiple time steps to obtain a prediction sequence of multiple water body data in the next time step.
[0038] Specifically, for the regional water quality prediction method in this embodiment, please refer to [link / reference]. Figure 2 As shown, it includes the following steps:
[0039] Step S21. Perform modal decomposition on the time series data corresponding to each detection node in the detection area per unit time to obtain the low-frequency component and high-frequency component corresponding to each detection data, and construct the low-frequency component data sequence and the high-frequency component data sequence.
[0040] In this embodiment, the water body data is complex and spans a long period, with its distribution encompassing both long-term trends and short-term fluctuations. These long-term trends and short-term fluctuations directly reflect the changing state of the water body and exhibit different frequencies. Therefore, to enhance the ability to perceive different frequency characteristics during subsequent prediction, this embodiment first performs mode decomposition on the complex water body data, obtaining multiple modes for each detected data sequence. These modes are then divided into low-frequency component sequences and high-frequency component sequences. The low-frequency component sequences contain multiple low-frequency components corresponding to the detected data, representing the long-term trend of the water body data; the high-frequency component sequences contain multiple high-frequency components corresponding to the detected data, representing the short-term trend of the water body data.
[0041] Among them, variational mode decomposition method is used for mode decomposition, based on initial parameters. and The modalities of each detected data sequence are decomposed, and the minimum envelope entropy value corresponding to each set of parameters after decomposition is determined. K is the penalty factor, and K is the number of decomposition levels.
[0042] Generally, the initial decomposition result is not optimal. Therefore, the initial parameters in the variational mode decomposition need to be updated to ensure the final result meets the optimal requirements. In this embodiment, the triangular topology aggregation optimization algorithm is used to implement this update method. This algorithm is an optimization method based on the principle of triangle similarity, which iteratively generates new vertices in the search space to form similar triangles of different sizes. In this process, each triangle is a basic evolutionary unit, and each evolutionary unit contains four agents: the three vertices of the triangle and an agent within a random vertex.
[0043] Specifically, during mode decomposition, the number of iterations, the population size, and the range of initial parameters for mode decomposition are first initialized. Then, the position of each unit in the triangular topology aggregation optimization algorithm is continuously updated until the maximum number of iterations is reached and the loop stops. Simultaneously, the entropy value corresponding to the mode decomposition in each iteration is obtained, and the decomposition parameter corresponding to the minimum envelope entropy value is used as the target decomposition parameter. Based on this target decomposition parameter, mode decomposition is performed on the time-series data to obtain the high-frequency and low-frequency components corresponding to each detection data point in this embodiment. The high-frequency components of all detection data are integrated based on time steps to obtain the corresponding high-frequency component sequence, and the low-frequency components of all detection data are integrated based on time steps to obtain the corresponding low-frequency component sequence.
[0044] The population size for initializing the number of iterations is 30, and the maximum number of iterations is 15. The optimization ranges for the two parameters of variational mode decomposition are [1000, 10000] and [2, 14]. The minimum envelope entropy is used as the fitness result. When the number of iterations reaches its maximum, the minimum envelope entropy value yields the optimal parameter combination, which is then used to decompose the detection data.
[0045] Step S22. Extract the long-term fluctuation features and short-term fluctuation features corresponding to the low-frequency component data sequence and the high-frequency component data sequence respectively, and couple the long-term fluctuation features and the short-term fluctuation features with the constructed graph network structure to obtain long-term spatiotemporal features and short-term spatiotemporal features respectively.
[0046] In this embodiment, the time features corresponding to low-frequency component data and high-frequency component data are obtained separately. Because the time trends of low-frequency and high-frequency components differ—low-frequency components exhibit long-term trends with insignificant changes over time, while high-frequency components show short-term trends with noticeable fluctuations in a short period—different strategies are needed to extract time features from these two types of data to ensure that the obtained time features reflect the temporal fluctuation characteristics of both data sets.
[0047] Specifically, this embodiment employs a convolutional long short-term memory network for extracting temporal features from low-frequency component data. By introducing convolutional processing through the input gate, forget gate, output gate, and memory unit computation, long-term dependencies can be effectively established. The processing logic involves obtaining the hidden state matrix of each low-frequency component at each time step, transforming each hidden state matrix to generate temporal pattern features with temporal relationships, obtaining the correlation between each hidden state and the temporal pattern features, updating the temporal pattern features based on the correlation to generate a context vector, and fusing the context vector with the current hidden state to obtain the hidden state. Here, the hidden state represents the temporal feature corresponding to the low-frequency component.
[0048] The process for acquiring the hidden state begins by inputting the low-frequency component data sequence into a convolutional long short-term memory (LSTM) network. The LSM network uses a forget gate to control which historical information needs to be retained, an input gate to select whether the currently input information should be added to the memory unit, and an output gate to determine which information should be input to the next layer. Specifically, the forget gate determines whether data from the previous time step should be retained based on the changing trends of data in adjacent time steps. It obtains the difference between the low-frequency components of the current time step and the previous time step and determines whether the difference exceeds a threshold. If the difference exceeds the threshold, the output of the forget gate for the current time step approaches 0; if the difference does not exceed the threshold, the output approaches 1. The input gate receives the output of the forget gate. When the received input approaches 1, the input gate accepts the current input and transmits it; when the received input approaches 0, the input gate ignores it and does not output, thus achieving the filtering of low-frequency components. After screening, the low-frequency components are used to extract the hidden states based on a long short-term memory network. All the hidden states of each detection node are then concatenated to obtain the final hidden state matrix, which represents the long-term fluctuation characteristics of the low-frequency component sequence.
[0049] In this embodiment, since the low-frequency component itself reflects the long-term trend of the detection data and its frequency changes less, by setting up a long short-term memory network, the data with changes in the long-term trend can be filtered and features can be extracted based on this data, so that the extracted features can focus on changes in the long-term trend.
[0050] Furthermore, in this embodiment, because the input detection data is multivariate data, each detection data point should have a different weight in relation to the overall trend change. Therefore, in order to assign corresponding weights to different features, this embodiment also includes an attention module capable of identifying and focusing on time steps in the time series that are important for target prediction. This allows the prediction process to assign different attention weights to different variables at the same time, thereby obtaining nonlinear relationships between different variables at different times. This enables subsequent predictions to effectively select key variables and key time patterns, thereby improving prediction capabilities.
[0051] Specifically, convolution is performed along the row vectors of the hidden state matrix using convolution kernels to obtain a temporal pattern matrix, where each row corresponds to the temporal feature pattern of a variable. Then, a correlation score is calculated between the temporal feature pattern of each variable and its corresponding hidden state at the current time step. This correlation score is used to update the temporal pattern features, generating a context vector. Finally, the context vector is fused with the current hidden state to obtain the final hidden state.
[0052] For a one-dimensional convolutional filter as the kernel, its convolution processing of row vectors is expressed by the following formula: Where T represents the interval length for attention calculation, and w is the sliding window length, i.e., the time length for convolution processing, which is set in this embodiment. , This represents the convolution value between the i-th row vector of the hidden state matrix and the j-th convolution kernel, containing the pattern features of each variable in the time dimension. n is the number of variables. In this embodiment, n is 6, which represents temperature, pH, dissolved oxygen, conductivity, permanganate index, and total nitrogen, respectively. k is the number of one-dimensional convolutional filters, i.e., the dimension of the extracted time feature pattern.
[0053] The relevance score is calculated using the weight matrix, based on the following formula: ,in For time-featured patterns, Given a trainable weight matrix, The hidden state at the current time step.
[0054] Attention weights are calculated from the relevance scores using the Sigmoid function. Then, attention weights are used to weight and sum the temporal pattern features to obtain the context vector as shown in the following formula: ,in This is the context vector.
[0055] Then, the context vector and the hidden state at the current time step are fused based on the corresponding weight matrix to obtain the final hidden state. The weight matrix is a trainable weight matrix, obtained through convergence during training. Specifically, the fusion method is represented by the following formula: ,in This is the final hidden state. and These are the weight matrices corresponding to the hidden state and the context vector, respectively.
[0056] In this embodiment, the long-term fluctuation characteristics with a long-term fluctuation trend can be obtained through the above process. For the short-term fluctuation characteristics of high-frequency components, a TCN network is used in this embodiment. When extracting features, the TCN network fills in the high-frequency component data to obtain the target high-frequency component data, and then extracts multiple local features of the target high-frequency component data through an expanded convolutional neural network and a residual structure. However, unlike existing TCN networks, because high-frequency component data has high volatility, it is difficult to focus on important features during feature extraction due to this volatility. Therefore, in order to highlight important features and suppress redundant features, a corresponding filtering mechanism is configured in this embodiment.
[0057] Specifically, the target high-frequency component data is first processed through multiple TCN residual blocks to gradually extract more complex features. Each residual block contains, in sequence, an expanded causal convolutional layer, a batch normalization layer, a ReLU activation layer, and a Dropout layer. The expanded causal convolutional layer is built upon causal convolution, and a dilation rate is added to the convolutional kernel to expand the receptive field. In this embodiment, the dilation rate is a hierarchical dilation rate, determined according to the level of the causal convolution. Specifically, in this embodiment, the dilation rate is 1 in the first layer, meaning that every input point is sampled; in the second layer, the dilation rate is 2, meaning that every other point is sampled, skipping a neuron. As the number of layers increases, the dilation coefficient grows exponentially, thus achieving a larger receptive field with fewer layers.
[0058] In each residual block, convolutional layers and activation functions are used to extract local features, while residual connections preserve the original input information, enabling the model to learn both low-level and high-level features simultaneously, thus obtaining multiple local features. These local features are then thresholded, setting the absolute values of features less than the threshold to 0, thereby preserving important features. The thresholding process is based on the following formula: , where x is the local feature of the input and y is the local feature of the output. The threshold is set. Then, a weight for each time step is calculated using a self-attention mechanism, and the local features at the corresponding time step are updated by weighted summation based on this weight, thereby highlighting important time steps and features to obtain the final short-term fluctuation features. The self-attention mechanism can be implemented using existing technologies, and will not be elaborated in this embodiment.
[0059] The temporal features corresponding to the high-frequency and low-frequency components obtained are not the final input features for prediction. This is because multiple detection nodes are set up in this embodiment, and the flow of water will cause spatial changes in the data. Therefore, in order to make the prediction results more accurate, it is necessary to couple the temporal features with the spatial relationship between the detection nodes, so that the final features include both temporal and spatial distribution relationships.
[0060] In this embodiment, the spatial coupling relationship is established using a graph network structure. The graph network structure is a topology formed by connecting each detection node to a graph node, where each graph node corresponds to one detection node.
[0061] In this embodiment, the construction of the graph network structure is crucial for spatial coupling. However, existing technologies typically employ static graph construction methods. This approach neglects the temporal relationships between remote nodes, failing to capture changes in the relationships arising from changes in the detection data over time during subsequent coupling processes. This results in a deviation between the coupling results and the spatial relationships.
[0062] Therefore, to solve this technical problem, this embodiment provides a method for graph structure changes over time. The processing logic is as follows: first, a static graph is generated based on the detection data; then, the static graph is updated according to the changes in the input long-term and short-term fluctuation features to obtain the updated graph structure; finally, the updated graph structure is coupled with the corresponding long-term and short-term fluctuation features to obtain the final coupled features.
[0063] Specifically, the method for generating a static graph first obtains the spatial relationships between each detection node, then constructs a topology structure corresponding to multiple detection nodes based on the distribution requirements of the spatial relationships, and finally constructs an initial adjacency matrix based on the detection data corresponding to the associated detection nodes in the topology structure. The calculation process for the spatial relationship, specifically the geographical distance between each detection node, is as follows: Where dist(i,j) represents the geographical distance between detection node i and detection node j, and R represents the Earth's radius. and The coordinates of the two detection nodes are represented by latitude and longitude, and H represents the semi-sine function.
[0064] Then, based on a distance threshold, the multiple geographic distances are filtered, retaining only those that meet the threshold requirements. For each target geographic distance, two associated detection nodes are determined to form an associated detection node pair. A static graph and an initial adjacency matrix corresponding to the geographic distances of the multiple associated detection nodes are generated. Specifically, the initial adjacency matrix is determined based on the inverse distance function of a Gaussian kernel, representing the influence of each detection node on another detection node. Its calculation is based on the following formula: ,in It controls the adjacency matrix. Parameters of distribution and density, It is a distance threshold; , where N is the number of detection nodes. When the distance between two detection nodes is large, their mutual influence is extremely weak and can be ignored.
[0065] The above processing yields the initial adjacency matrix corresponding to the static graph. This initial adjacency matrix is the core of the constructed static graph, used to represent the spatial relationships between the graph nodes. The obtained initial adjacency matrix needs to be updated during feature coupling. The process first maps the initial adjacency matrix to the embedding space through a linear transformation during coupling, based on the following equation: Where N represents the number of detection nodes, and d represents the feature dimension corresponding to each detection node. Then, the embedding of the initial adjacency matrix is extended to the time dimension and copied according to the batch size to obtain the spatial location embedding, the processing of which is based on the following formula: Where T represents the number of time steps. This represents the spatial location embedding. Then, the spatial location embedding is added to the long-term fluctuation feature and short-term fluctuation feature corresponding to the current detection node in the current time step, combining the input temporal features and spatial location to obtain the long-term fluctuation update feature and the short-term fluctuation update feature. Specifically, the two types of features corresponding to the detection node have the same shape as the location embedding; the addition process combines the input features and the location embedding.
[0066] Based on the two types of fluctuation update features obtained, coupled long-term and short-term spatiotemporal features are obtained through self-attention updates. Specifically, self-attention calculations are first performed on the input long-term and short-term fluctuation update features respectively to generate corresponding query vectors, key vectors, and value vectors. Further, the query vector is represented by the following formula: , ,in , These are the query vectors corresponding to long-term fluctuation update features and short-term fluctuation update features, respectively. , These are respectively long-term fluctuation update characteristics and short-term fluctuation update characteristics. It is a learnable query weight matrix; the key vector is represented based on the following formula: , ,in , These are the key vectors corresponding to the long-term fluctuation update features and the short-term fluctuation update features, respectively. The key weight matrix is a learnable matrix; the value vector is represented based on the following formula: , ,in , These are the value vectors corresponding to the long-term fluctuation update features and the short-term fluctuation update features, respectively. is a learnable value weight matrix.
[0067] Based on the multiple vectors obtained from the above processing, the corresponding self-attention weights are then calculated using the following formula: .
[0068] The self-attention mechanism filters spatial relationships based on location embedding, thus integrating accurate spatial relationships into the coupled long-term and short-term spatiotemporal features. After self-attention computation, the features are added to the corresponding long-term and short-term fluctuation features of the input through skip connections, followed by layer normalization and Dropout processing, and then processed through a feedforward network. Finally, a second normalization and Dropout processing are performed to obtain the corresponding long-term and short-term spatiotemporal features, which respectively contain the corresponding dynamic spatial dependency information.
[0069] Step S23. The long-term and short-term features are fused to obtain fused features, and the multi-parameter prediction sequence of each detection node in the future time step is obtained based on the fused features.
[0070] In this embodiment, long-term spatiotemporal features represent the spatial distribution of long-term trends, and short-term spatiotemporal features represent the spatial distribution of short-term fluctuations. The fusion of the above features is achieved by splicing to obtain fused features and fused features.
[0071] The obtained fused features are then processed through an MLP network to obtain prediction results for multiple parameters at corresponding nodes within future time steps. The MLP network includes an input layer, hidden layers, and an output layer. In this embodiment, the number of neurons in the input layer matches the dimension of the fused features, allowing the high-dimensional fused features to be introduced into the subsequent processing network. The hidden layer includes nonlinear transformation and layer-by-layer feature abstraction. In the nonlinear transformation, each hidden layer neuron performs a weighted summation of the input features and adds a bias term. The result is then processed through a nonlinear activation function, and the processed result undergoes a nonlinear transformation to determine the deep information most relevant to the final prediction target. A linear activation function is configured in the output layer, and the number of neurons in the output layer corresponds to the number of output parameters, obtaining the predicted value for each parameter within a future time step, thus achieving a complete output of the prediction result for the corresponding detection node.
[0072] The regional water quality prediction method provided in this application embodiment can perform modal decomposition based on the frequency distribution of the detection data, extract the temporal features of the decomposed modal components, and couple the temporal features through an adaptively updated graph network structure. This allows the temporal features to be combined with spatial features to obtain spatiotemporal features. Finally, the spatiotemporal features of two different moduli are fused to obtain the prediction result. Compared with the prior art, this application embodiment can start from the characteristics of water quality data, taking into account the long-term fluctuations, short-term fluctuations, and spatial variability of water quality data. It performs multiple feature extractions and optimizes the temporal and spatial features of the data, ultimately obtaining a fused feature that reflects the spatiotemporal distribution of water quality data, and based on this fused feature, it achieves the accuracy of regional water quality prediction results.
[0073] See Figure 3 The server 13 in this embodiment specifically includes the following modules:
[0074] The data decomposition device 131 is used to perform modal decomposition on the multivariate time series data corresponding to each detection node in the detection area within a unit time, to obtain the low-frequency component and high-frequency component corresponding to each detection data, and to construct multivariate low-frequency component data and multivariate high-frequency component data.
[0075] The feature extraction device 132 is used to extract the long-term fluctuation features and short-term fluctuation features corresponding to the low-frequency component data sequence and the high-frequency component data sequence, respectively, and couple the long-term fluctuation features and the short-term fluctuation features with the constructed graph network structure to obtain long-term spatiotemporal features and short-term spatiotemporal features.
[0076] The prediction device 133 is used to fuse the long-term fluctuation features and the short-term fluctuation features to obtain fused features, and to obtain multi-parameter prediction sequences for each of the detection nodes in future time steps based on the fused features.
[0077] See Figure 4 The above methods can also be integrated into the provided terminal device 400. Since the device may vary significantly due to differences in configuration or performance, it may include one or more processors 401 and memories 402. The memory 402 may store one or more application programs or data. The memory 402 can be temporary or persistent storage. The application programs stored in the memory 402 may include one or more modules (not shown in the figure), each module may include a series of computer-executable instructions from the terminal device. Furthermore, the processor 401 may be configured to communicate with the memory 402, and the terminal device may execute the series of computer-executable instructions stored in the memory 402. The terminal device may also include one or more power supplies 403, one or more wired / wireless network interfaces 404, one or more input / output interfaces 405, one or more keyboards 406, etc.
[0078] In one specific embodiment, the terminal device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for use in the terminal device, and is configured to be executed by one or more processors. The one or more programs include computer-executable instructions for performing the following:
[0079] Modal decomposition is performed on the time series data corresponding to each detection node in the detection area per unit time to obtain the low-frequency component and high-frequency component corresponding to each detection data, and the low-frequency component data sequence and high-frequency component data sequence are constructed.
[0080] The long-term fluctuation features and short-term fluctuation features corresponding to the low-frequency component data sequence and the high-frequency component data sequence are extracted respectively, and the long-term fluctuation features and the short-term fluctuation features are coupled with the constructed graph network structure to obtain long-term spatiotemporal features and short-term spatiotemporal features respectively; the graph network structure is constructed based on each of the detection nodes as graph nodes and has a graph node connection relationship topology.
[0081] The long-term and short-term features are fused to obtain fused features, and multi-parameter prediction sequences for each detection node in future time steps are obtained based on the fused features.
[0082] Optionally, the processor can perform various functions, such as the above-mentioned functions, by running or executing software programs stored in memory and by calling data stored in memory. Figure 2 The method shown.
[0083] In a specific implementation, as one example, the processor may include one or more microprocessors.
[0084] The memory is used to store the software program that executes the solution of this application, and the execution is controlled by the processor. The specific implementation method can be referred to the above method embodiment, which will not be repeated here.
[0085] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0086] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0087] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0088] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0089] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0090] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for predicting regional water quality, characterized in that, The method includes: Modal decomposition is performed on the time series data corresponding to each detection node in the detection area per unit time to obtain the low-frequency component and high-frequency component corresponding to each detection data, and the low-frequency component data sequence and high-frequency component data sequence are constructed. The long-term fluctuation features and short-term fluctuation features corresponding to the low-frequency component data sequence and the high-frequency component data sequence are extracted respectively, and the long-term fluctuation features and the short-term fluctuation features are coupled with the constructed graph network structure to obtain long-term spatiotemporal features and short-term spatiotemporal features respectively; the graph network structure is constructed based on the detection nodes, with each detection node as a graph node and having a graph node connection relationship topology. The long-term and short-term features are fused to obtain fused features, and multi-parameter prediction sequences for each detection node in future time steps are obtained based on the fused features.
2. The regional water quality prediction method according to claim 1, characterized in that, Modal decomposition of the time-series data includes: decomposing the modal components of each detection data based on initial parameters and determining the initial minimum envelope entropy value corresponding to each set of parameters after decomposition; updating the initial parameters multiple times based on a preset number of updates to obtain corresponding update parameters, and decomposing the modal components of each detection data based on each update parameter, selecting and determining the decomposition parameters corresponding to the minimum envelope entropy value after multiple decompositions as target decomposition parameters, and performing modal decomposition of the time-series data based on the target decomposition parameters.
3. The regional water quality prediction method according to claim 1, characterized in that, Extracting long-term fluctuation features of the low-frequency component data includes: obtaining hidden state matrices of multiple low-frequency components at each time step, transforming each hidden state to generate a time pattern feature with a time relationship, obtaining the correlation between each hidden state and the time pattern feature, updating the time pattern feature based on the correlation to generate a context vector, and fusing the context vector with the current hidden state to obtain the hidden state, wherein the hidden state is the time feature.
4. The regional water quality prediction method according to claim 3, characterized in that, Transforming each of the hidden states to generate temporal pattern features with temporal relationships includes: performing convolution processing along the row vectors of the hidden state matrix based on the convolution kernel to obtain a temporal pattern matrix, wherein each row of the temporal pattern matrix corresponds to a temporal feature pattern of a variable.
5. The regional water quality prediction method according to claim 1, characterized in that, Extracting short-term fluctuation features from the high-frequency component data includes: padding the high-frequency component data to obtain target high-frequency component data; extracting multiple local features from the target high-frequency component data; updating the multiple local features based on a preset feature distribution requirement to obtain multiple updated local features; obtaining attention weights corresponding to the multiple updated local features; and weighted fusing the multiple updated local features based on the attention weights to obtain the short-term fluctuation features.
6. The regional water quality prediction method according to claim 1, characterized in that, Constructing a graph network structure based on each of the detection nodes includes: obtaining the spatial positional relationship between each of the detection nodes, constructing a topology structure corresponding to multiple detection nodes based on the distribution requirements of the spatial positional relationship, and constructing an initial adjacency matrix based on the detection data corresponding to the associated detection nodes on the topology structure.
7. The regional water quality prediction method according to claim 6, characterized in that, The spatial location relationship is the geographical distance between each detection node. Based on the distribution requirements of the spatial location relationship, a topology structure corresponding to multiple detection nodes is constructed, including: filtering multiple geographical distances according to a distance threshold and retaining only multiple target geographical distances that meet the threshold requirements, determining two associated detection nodes corresponding to each target geographical distance to form an associated detection node pair, and generating a static graph and an initial adjacency matrix corresponding to the static graph based on the geographical distances corresponding to multiple associated detection nodes.
8. The regional water quality prediction method according to claim 6, characterized in that, The long-term fluctuation features and the short-term fluctuation features are coupled with the constructed graph network structure, respectively, including: obtaining an embedding matrix by linear transformation of the initial adjacency matrix; expanding the embedding matrix based on the time dimension of the time series data and copying it according to batch size to obtain a spatial location embedding matrix; combining the long-term fluctuation features and the short-term fluctuation features with the spatial location embedding matrix to obtain long-term fluctuation update features and short-term fluctuation update features; and updating the long-term fluctuation update features and short-term fluctuation update features based on self-attention to obtain coupled long-term spatiotemporal features and short-term spatiotemporal features.
9. The regional water quality prediction method according to claim 8, characterized in that, The long-term fluctuation update features and short-term fluctuation update features are updated based on self-attention, including: generating query vectors, key vectors and value vectors corresponding to the long-term fluctuation update features and short-term fluctuation update features, obtaining attention weights based on the query vectors, key vectors and value vectors, and updating the long-term fluctuation features and short-term fluctuation features based on the attention weights.
10. A regional water quality prediction system, characterized in that, The system includes multiple detection nodes and a processing terminal set up within a detection area. Each detection node is used to acquire detection data within a sub-area. Each detection node is equipped with multiple data acquisition units and data transmission units. Each data acquisition unit is equipped with multiple data acquisition devices for acquiring multiple water quality-related detection data within the sub-area. The data transmission units are used to transmit the multiple detection data to the processing terminal. The processing terminal is used to execute the regional water quality prediction method according to any one of claims 1-9. The processing terminal includes: The data decomposition device is used to perform modal decomposition on the multivariate time-series data corresponding to each detection node in the detection area per unit time, to obtain the low-frequency and high-frequency components corresponding to each detection data, and to construct multivariate low-frequency component data sequences and multivariate high-frequency component data sequences. The feature extraction device is used to extract the long-term fluctuation features and short-term fluctuation features corresponding to the low-frequency component data sequence and the high-frequency component data sequence, respectively, and couple the long-term fluctuation features and the short-term fluctuation features with the constructed graph network structure to obtain long-term spatiotemporal features and short-term spatiotemporal features. A prediction device is used to fuse the long-term spatiotemporal features and the short-term spatiotemporal features to obtain fused features, and to obtain multi-parameter prediction sequences for each of the detection nodes in future time steps based on the fused features.