Flood season water quality multivariable time sequence prediction method and system
Through the synergistic modeling of inverted attention mechanism and differential attention enhancement, the problems of insufficient correlation modeling, noise sensitivity and long-term dependency processing efficiency in multivariate time series prediction are solved, and more efficient and accurate prediction of water quality during flood season are achieved.
Patent Information
- Application Number
- CN202510690379.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-06-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When traditional Transformers deal with multivariate time series, there are problems such as insufficient multivariate correlation modeling, noise sensitivity and long-term dependency processing efficiency, making it difficult to effectively predict water quality during flood season.
A multivariable time series prediction method for water quality during flood season is proposed. Through inverted attention mechanism modeling and differential attention enhancement, coordinated modeling is used to improve the calculation efficiency and prediction accuracy of the model.
Through the inverted attention mechanism, the differential attention mechanism significantly reduces noise interference, improves the ability to extract key features, enhances the modeling ability of long-sequence data, and adapts to large-scale time series data and non-stationary data.
Smart Images

Figure CN120197531A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and specifically, to a method and system for predicting multi-variable time series of flood season water quality. Background Art
[0002] Flood season water quality prediction is a core issue in water resources management and environmental protection. Multivariate time series data usually has complex correlations, significant noise interference, and long-term dependencies, which pose high requirements for modeling methods. Traditional methods (such as RNN and LSTM) have limited performance in dealing with these problems, while the Transformer model has gradually become mainstream due to the flexibility and efficiency of its self-attention mechanism. However, the standard Transformer has the following deficiencies when dealing with multivariate time series: Insufficient modeling of multivariate correlations: Embedding different variables as a single time marker may disrupt the complex dependencies between variables, making it difficult for the attention mechanism to effectively capture the global interactions between variables. Noise sensitivity: The time series data contains a large amount of noise, and the traditional attention mechanism is easily affected by noise and difficult to focus on key information. Low processing efficiency for long-term dependencies: As the time window grows, the sparsity of the attention distribution increases, and the model's computational complexity and prediction accuracy are restricted.
[0003] Therefore, how to provide a flood season water quality prediction method that reduces the model's computational complexity and improves the prediction accuracy has become an urgent problem to be solved in this field. Summary of the Invention
[0004] This application proposes a method for predicting multi-variable time series of flood season water quality, including the following steps: obtaining data and performing data preprocessing; after completing data preprocessing, performing inverted attention mechanism modeling; after completing inverted attention mechanism modeling, performing differential attention enhancement; after completing differential attention enhancement, performing time dependence modeling; after completing time dependence modeling, training and optimizing the model; and performing prediction and evaluation according to the trained and optimized model.
[0005] The method for predicting multi-variable time series of flood season water quality as described above, wherein obtaining data includes obtaining hydrometeorological data and water quality index data.
[0006] The method for predicting multi-variable time series of flood season water quality as described above, wherein performing data preprocessing includes the following sub-steps: performing normalization processing; filling missing values; grouping features; and reconstructing the input matrix.
[0007] The method for predicting multi-variable time series of flood season water quality as described above, wherein performing inverted attention mechanism modeling includes the following sub-steps: constructing an input sequence centered on variables; and calculating the global attention distribution between variables.
[0008] The flood season water quality multivariate time series prediction method as described above, wherein the differential attention enhancement includes the following sub-steps: performing a differential operation to suppress redundant information; and enhancing important signals.
[0009] A flood season water quality multivariate time series prediction system, comprising: a preprocessing unit, an inverted attention mechanism modeling unit, a differential attention enhancement unit, a time dependence modeling unit, a model training and optimization unit, and a prediction evaluation unit; the preprocessing unit is configured to obtain data and perform data preprocessing; the inverted attention mechanism modeling unit is configured to perform inverted attention mechanism modeling; the differential attention enhancement unit is configured to perform differential attention enhancement; the time dependence modeling unit is configured to perform time dependence modeling; the model training and optimization unit is configured to perform training and optimization of the model; and the prediction evaluation unit is configured to perform prediction and evaluation according to the trained and optimized model.
[0010] The flood season water quality multivariate time series prediction system as described above, wherein the data obtained by the preprocessing unit includes hydrometeorological data and water quality index data.
[0011] The flood season water quality multivariate time series prediction system as described above, wherein the data preprocessing performed by the preprocessing unit includes the following sub-steps: performing normalization processing; filling missing values; performing feature grouping; and reconstructing the input matrix.
[0012] The flood season water quality multivariate time series prediction system as described above, wherein the inverted attention mechanism modeling unit performing inverted attention mechanism modeling includes the following sub-steps: constructing an input sequence centered on variables; and calculating the global attention distribution between variables.
[0013] The flood season water quality multivariate time series prediction system as described above, wherein the differential attention enhancement unit performing differential attention enhancement includes the following sub-steps: performing a differential operation to suppress redundant information; and enhancing important signals.
[0014] This application has the following beneficial effects: This application synergistically models by introducing differential and inverted attention mechanisms. The inverted attention mechanism effectively extracts global dependencies through variable dimension modeling. The differential attention mechanism significantly reduces noise interference through difference calculation and improves the ability to extract key features. At the same time, the synergistic effect of the two mechanisms significantly enhances the modeling ability for long sequence data. The lightweight design of the model adapts to the application scenarios of large-scale time series data. And it has stronger adaptability to non-stationary data and complex systems, and has a wider range of applicability. Description of the Drawings
[0015] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments recorded in the present application. For those of ordinary skill in the art, other accompanying drawings can also be obtained based on these drawings.
[0016] Figure 1 It is a schematic flowchart of a flood season water quality multivariate time series prediction method provided according to an embodiment of the present application; Figure 2 It is a schematic internal structure diagram of a flood season water quality multivariate time series prediction system provided according to an embodiment of the present application. Specific Embodiments
[0017] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of them. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts belong to the scope of protection of the present application. Embodiment 1
[0018] As Figure 1 shown, this embodiment provides a flood season water quality multivariate time series prediction method, which specifically includes the following steps: Step S1: Obtain data and perform data preprocessing.
[0019] Among them, the data selected in this embodiment is hydrometeorological data and water quality index data.
[0020] The water quality index data includes data such as dissolved oxygen, ammonia nitrogen, and COD.
[0021] The hydrometeorological data includes data such as rainfall, temperature, wind speed / direction, flow rate, water level, runoff, and sediment content.
[0022] The data preprocessing specifically includes the following sub-steps: Step S11: Perform normalization processing.
[0023] Among them, the normalization processing unifies the numerical ranges of different data variables and reduces the influence caused by different dimensions.
[0024] Specifically, it is implemented using the standardization (Z-score) or min-max normalization method. The specific implementation method can refer to the sklearn.preprocessing module in the existing technology Python. The process will not be elaborated here.
[0025] Step S12: Fill in missing values.
[0026] Specifically, interpolation methods (linear interpolation, time series interpolation) are used to fill in the missing values in the time series; or filling is performed based on the statistical characteristics (mean, median) of the variables.
[0027] Among them, the interpolate() function or SimpleImputer in the pandas module of the existing technology Python can be used, and the process will not be elaborated here.
[0028] Step S13: Group features according to the data.
[0029] Among them, grouping features according to the data includes grouping related data variables to facilitate capturing the dependencies between variables in subsequent modeling.
[0030] Specifically, grouping is performed according to the physical meanings of the data variables (such as rainfall, flow, pollutant concentration). The grouping index can be generated by assigning labels to the data variables, and the grouping mapping relationship is recorded, thereby obtaining the grouped variables associated.
[0031] Among them, variable grouping refers to combining multiple features with similar attributes or correlations together to facilitate subsequent data analysis, modeling, or dimensionality reduction. The purpose of variable grouping is to reduce the data dimension, improve the computational efficiency of the model, and at the same time reduce noise and improve the generalization ability. Mapping relationships such as trying to use dissolved oxygen, pH, ammonia nitrogen, conductivity, nitrite nitrogen, total phosphorus, total nitrogen, chemical oxygen demand, and nitrate nitrogen to predict permanganate index, and using pH, ammonia nitrogen, conductivity, total phosphorus, total nitrogen, and chemical oxygen demand to predict dissolved oxygen, etc.
[0032] Step S14: Reconstruct the input matrix.
[0033] Among them, the transpose operation of numpy or pandas can be used to convert the shape of the obtained data from [T, N] to [N, T], where T is the number of time steps and N is the number of variables.
[0034] Step S2: After completing the data preprocessing, perform inverted attention mechanism modeling.
[0035] The core idea of the Inverted Attention Mechanism (INVERTED) is to readjust the modeling dimension of the Transformer model, extract the global correlation of time series data from the perspective of variables, so as to solve the key problems of traditional Transformer in dealing with multivariate time series. The specific principles include the following points: 1. Inversion of the modeling perspective Traditional Transformer models treat each time step of a multivariate time series as a temporal token and capture the dependencies between these time tokens through self-attention mechanisms. However, this approach tends to overlook the complex interaction relationships between different variables. The inverted attention mechanism reorganizes the data input centered around variables, treats each variable as an independent sequence (variable-centric token), and captures the global dependencies between variables through the attention mechanism.
[0036] 2. Capturing Global Variable Dependencies Under the framework of inverted modeling, the focus of the attention mechanism shifts from the time dimension of the time series to the variable dimension. By calculating the global attention distribution between variables, the model can capture the complex dependencies and interrelationships between different variables.
[0037] 3. Globalization of Variable Representations The inverted attention mechanism constructs a global representation for each variable, that is, extracts the key features of the variable based on all time step data. This globalized variable representation can capture the overall trend of the variable, thereby avoiding the key information lost due to the limitation of the local receptive field in traditional methods.
[0038] 4. Optimization of Sequence Length and Computational Efficiency Inverted attention reduces the number of time steps in time series modeling. For high-frequency or long-time-span data, this mechanism significantly reduces the computational complexity, makes the model more efficient, and at the same time improves the modeling ability for long time series data.
[0039] In summary, step S2 includes the following sub-steps: Step S21: Construct an input sequence centered around variables.
[0040] Among them, each variable's time series is processed separately, and the embedding layer is used to map the original variable to a high-dimensional representation, forming an input sequence matrix [N, T, d] centered around variables, where d is the embedding dimension.
[0041] Step S22: Calculate the global attention distribution between variables.
[0042] Among them, a custom attention module is implemented through PyTorch or TensorFlow, and the attention mechanism between variables is applied to the input matrix. Calculate the correlation scores between each pair of variables to form a global attention distribution matrix.
[0043] Step S3: After completing the inverted attention mechanism modeling, perform differential attention enhancement.
[0044] Among them, the differential attention enhancement specifically combines differential attention with inverted attention, so as to give play to the complementary advantages of the two mechanisms in different-dimensional modeling. The main manifestations are as follows: Synergy between variable global dependence and key feature extraction: The inverted attention mechanism focuses on modeling the global dependence between variables, while the differential attention mechanism further improves the effectiveness of the global representation by enhancing the selectivity for key information.
[0045] Optimization of noise suppression and multi-variable correlation modeling: The inverted attention effectively decouples the relationship between variables and time by reorganizing the modeling dimensions; on this basis, the differential attention removes irrelevant information and significantly improves the modeling ability of multi-variable correlations.
[0046] Enhanced long-time series modeling ability: The sparsification effect of the differential attention mechanism significantly reduces the attention dispersion problem in long-time series modeling. Working in synergy with the inverted attention, it enables the efficient extraction of key features over long time spans.
[0047] Combination of efficiency and robustness: The inverted attention improves the computational efficiency by reducing the complexity of the input sequence, while the differential attention further enhances the robustness of the model to noise and non-stationary data, making it more suitable for practical application scenarios.
[0048] In summary, step S3 includes the following sub-steps: Step S31: Perform a differential operation to suppress redundant information.
[0049] Specifically, construct two attention distributions (such as global attention A1 and local attention A2), and then calculate the differential attention A_DIFF = softmax(A1 - A2). Through the differential operation, the overlapping parts in the attention distribution can be eliminated, highlighting the key relationships between variables.
[0050] Step S32: Strengthen important signals.
[0051] Specifically, strengthening important signals includes combining differential attention with variable embedding, re-weighting important feature variables, and the enhanced variable V_new = A_DIFF * V, where V represents the original variable.
[0052] Step S4: After completing the differential attention enhancement, perform time-dependence modeling.
[0053] In this embodiment, an Encoder-Only framework is used for design and modeling. The model consists of six components in total, including input encoding, embedding encoding, multi-head self-attention mechanism, feed-forward neural network, residual connection, layer normalization, and output layer. To simplify the method design and facilitate structure maintenance, an inverted attention mechanism is implemented in the embedding encoding stage, that is, each variable is regarded as an independent sequence to capture the overall trend of the variable, and the global dependencies between variables are captured through the attention mechanism. In the multi-head self-attention mechanism stage, a differential attention mechanism is implemented to explicitly reduce the redundant information in the attention distribution, thereby improving the prediction accuracy and robustness.
[0054] In summary, the time-dependent modeling includes the following sub-steps: Step S41: Use the multi-head self-attention mechanism to capture the dependencies in the time dimension.
[0055] Among them, the multi-head self-attention mechanism is applied to the time series of each variable to extract the long-term and short-term features in the time dimension.
[0056] Specifically, the above operations can be completed using the MultiheadAttention in PyTorch or the attention module in TensorFlow.
[0057] Step S42: Combine positional encoding to enhance the representation of the time series.
[0058] Among them, positional encoding is introduced to retain the time dependencies of the time series.
[0059] Step S5: After completing the time-dependent modeling, perform the training and optimization of the model.
[0060] Among them, the training and optimization of the model include the following sub-steps: Step S51: Select the loss function.
[0061] Among them, the mean squared error (MSE) or cross-entropy is used as the loss function.
[0062] Step S52: Apply the regularization strategy.
[0063] Among them, Dropout or L2 regularization is added to avoid overfitting of the model.
[0064] Step S53: Select the optimizer.
[0065] Among them, the Adam optimizer is used and a learning rate scheduler (such as ReduceLROnPlateau) is set to dynamically adjust the learning rate.
[0066] Step S6: Make predictions and evaluations according to the trained and optimized model.
[0067] Among them, the prediction and evaluation include the following sub-steps: Step S61: Input the test set data, and the trained and optimized model outputs the prediction result.
[0068] Among them, the output prediction result can be compared with the true value to test the prediction accuracy. Among them, if the accuracy is less than the specified threshold, it means that the prediction accuracy is low, and then step S62 is executed.
[0069] Among them, after the prediction result is output, the accuracy of the prediction result needs to be verified. If the immediate comparison between the prediction result and the true value cannot be completed temporarily, there may be a loss of the prediction result due to device power failure, thus the verification of prediction accuracy cannot be completed. Therefore, this embodiment also includes temporarily storing the output prediction result.
[0070] Among them, since the prediction result can be the dissolved oxygen, flow rate, rainfall, etc. in a future time period, this embodiment regards the prediction result as a file form, selects a specified number of nodes in the device for storing the prediction result, and stores the prediction result in a specified node.
[0071] Among them, first select a specified number of starting nodes and transmission nodes. Determine the optimal path among multiple starting nodes and transmission nodes, and store the prediction result in the storage node according to the optimal path.
[0072] Specifically, determine the transmission cost of directly transmitting data between the starting node and the storage node , since there may be a long transmission distance between the starting node and the storage node, when determining the transmission cost , the transmission distance is also used as a reference parameter, specifically expressed as: ; Among them represents the transmission bandwidth from the starting node i to the storage node o, represents the transmission distance from the starting node i to the storage node o, represents the probability of random failure of the starting node i.
[0073] Determine the transmission cost between the starting node and the storage node via the transmission node, specifically expressed as : ; Among them represents the transmission bandwidth from the starting node i to the transmission node j, represents the transmission bandwidth from the transmission node j to the storage node o, represents the probability of random failure of the starting node i, Represents the probability of random failure of transmission node j.
[0074] When is greater than then it is selected that the starting node directly transmits the prediction result to the storage node for storage.
[0075] When is less than then it is selected that the starting node transmits the data to the transmission node, and the data is transmitted to the storage node through the transmission node.
[0076] Step S62: Perform performance evaluation after outputting the prediction result.
[0077] Among them, the performance evaluation includes examining the prediction accuracy, robustness, and computational efficiency of the model.
[0078] Specifically, it can be implemented using scikit - learn in Python or custom code for evaluation.
[0079] Embodiment 2 As Figure 2 shown, a flood season water quality multi - variable time - series prediction system provided by an embodiment of the present application specifically includes: a pre - processing unit 210, an inverted attention mechanism modeling unit 220, a differential attention enhancement unit 230, a time - dependence modeling unit 240, a model training and optimization unit 250, and a prediction evaluation unit 260.
[0080] The pre - processing unit 210 is used to obtain data and perform data pre - processing.
[0081] Among them, the data selected in this embodiment is hydrometeorological data and water quality index data.
[0082] The water quality index data includes data such as dissolved oxygen, ammonia nitrogen, and COD.
[0083] The hydrometeorological data includes data such as rainfall, temperature, wind speed / direction, flow rate, water level, runoff, and sediment content.
[0084] The pre - processing unit 210 specifically performs the following sub - steps: Step T1: Perform normalization processing.
[0085] Among them, the normalization processing unifies the numerical ranges of different variables and reduces the influence caused by different dimensions.
[0086] Specifically, it is implemented using the standardization (Z - score) or min - max normalization method, and the specific implementation method can refer to the sklearn.preprocessing module in the existing technology Python. The process will not be elaborated here.
[0087] Step T2: Fill in the missing values.
[0088] Specifically, interpolation methods (linear interpolation, time series interpolation) are used to complete the missing values in the time series; or filling is performed based on the statistical characteristics (mean, median) of the variables.
[0089] Among them, the interpolate() function or SimpleImputer in the pandas module in the existing technology Python can be used, and the process will not be elaborated here.
[0090] Step T3: Group the features according to the data.
[0091] Among them, grouping the features according to the data includes grouping the related data variables to facilitate capturing the dependencies between variables in subsequent modeling.
[0092] Specifically, grouping is performed according to the physical meaning of the data variables (such as rainfall, flow, pollutant concentration). The grouping index can be generated by assigning labels to the data variables, and the grouping mapping relationship is recorded, so as to obtain the grouped variables.
[0093] Step T4: Reconstruct the input matrix.
[0094] Among them, the transpose operation of numpy or pandas can be used to convert the shape of the obtained data from [T, N] to [N, T], where T is the number of time steps and N is the number of variables.
[0095] The inverted attention mechanism modeling unit 220 is used to perform inverted attention mechanism modeling after data preprocessing.
[0096] The core idea of the inverted attention mechanism (Inverted Attention Mechanism, INVERTED) is to readjust the modeling dimension of the Transformer model, extract the global correlation of time series data from the perspective of variables, so as to solve the key problems of traditional Transformer in processing multivariate time series. The specific principles include the following points: 1. Inversion of the modeling perspective Traditional Transformer models treat each time step of a multivariate time series as a temporal token and capture the dependencies between these time tokens through the self-attention mechanism. However, this approach tends to overlook the complex interaction relationships between different variables. The inverted attention mechanism reorganizes the data input centered around variables, treats each variable as an independent sequence (variable-centric token), and captures the global dependencies between variables through the attention mechanism.
[0097] 2. Capturing Global Variable Dependencies In the framework of inverted modeling, the focus of the attention mechanism shifts from the time dimension of the time series to the variable dimension. By calculating the global attention distribution between variables, the model can capture the complex dependencies and interrelationships between different variables.
[0098] 3. Globalization of Variable Representations The inverted attention mechanism constructs a global representation for each variable, that is, extracts the key features of the variable based on all time step data. This globalized variable representation can capture the overall trend of the variable, thus avoiding the key information lost due to the limitation of the local receptive field in traditional methods.
[0099] 4. Optimization of Sequence Length and Computational Efficiency Inverted attention reduces the number of time steps in time series modeling. For high-frequency or long-time-span data, this mechanism significantly reduces the computational complexity, makes the model more efficient, and at the same time improves the modeling ability for long-time series data.
[0100] In summary, the inverted attention mechanism modeling unit 220 performs the following sub-steps: Step Q1: Construct an input sequence centered around variables.
[0101] Among them, each variable's time series is processed separately, and the embedding layer is used to map the original variable to a high-dimensional representation, forming an input sequence matrix centered around variables [N, T, d], where d is the embedding dimension.
[0102] Step Q2: Calculate the global attention distribution between variables.
[0103] Among them, a custom attention module is implemented through PyTorch or TensorFlow, and the attention mechanism between variables is applied to the input matrix. Calculate the correlation scores between each pair of variables to form a global attention distribution matrix.
[0104] The differential attention enhancement unit 230 is used to perform differential attention enhancement after the inverted attention mechanism modeling.
[0105] Specifically, the differential attention enhancement is achieved by combining differential attention with inverted attention, enabling the complementary advantages of the two mechanisms in different-dimensional modeling to be exploited. The main manifestations are as follows: Synergy between variable global dependence and key feature extraction: The inverted attention mechanism focuses on modeling the global dependence between variables, while the differential attention mechanism further improves the effectiveness of the global representation by enhancing the selectivity for key information.
[0106] Optimization of noise suppression and multi-variable correlation modeling: The inverted attention effectively decouples the relationship between variables and time by reorganizing the modeling dimensions; the differential attention removes irrelevant information on this basis, significantly enhancing the modeling ability for multi-variable correlations.
[0107] Enhanced long-time series modeling ability: The sparsification effect of the differential attention mechanism significantly reduces the attention dispersion problem in long-time series modeling, and in cooperation with the inverted attention, enables the efficient extraction of key features over long time spans.
[0108] Combination of efficiency and robustness: The inverted attention improves the computational efficiency by reducing the complexity of the input sequence, while the differential attention further enhances the robustness of the model to noise and non-stationary data, making it more suitable for practical application scenarios.
[0109] In summary, the differential attention enhancement unit 230 performs the following sub-steps: Step W1: Perform a differential operation to suppress redundant information.
[0110] Specifically, two attention distributions are constructed (such as global attention A1 and local attention A2), and then the differential attention A_DIFF = softmax(A1 - A2) is calculated. Through the differential operation, the overlapping parts in the attention distribution can be eliminated, highlighting the key relationships between variables.
[0111] Step W2: Strengthen important signals.
[0112] Specifically, strengthening important signals includes combining differential attention with variable embeddings, re-weighting important feature variables, and the enhanced variable V_new = A_DIFF * V, where V represents the original variable.
[0113] The time dependence modeling unit 240 is used to perform time dependence modeling after the differential attention enhancement is completed.
[0114] In this embodiment, an Encoder-Only framework is used for design and modeling. The model includes a total of six components: input encoding, embedding encoding, multi-head self-attention mechanism, feed-forward neural network, residual connection, layer normalization, and output layer. To simplify the method design and facilitate structure maintenance, an inverted attention mechanism is implemented in the embedding encoding stage, that is, each variable is regarded as an independent sequence to capture the overall trend of the variable, and the global dependencies between variables are captured through the attention mechanism. In the multi-head self-attention mechanism stage, a differential attention mechanism is implemented to explicitly reduce the redundant information in the attention distribution, thereby improving the prediction accuracy and robustness.
[0115] In summary, the time-dependency modeling unit 240 performs the following sub-steps: Step R1: Capture the dependencies in the time dimension using the multi-head self-attention mechanism.
[0116] Apply the multi-head self-attention mechanism to the time series of each variable to extract the long-term and short-term features in the time dimension.
[0117] Specifically, the above operations can be completed using the MultiheadAttention in PyTorch or the attention module in TensorFlow.
[0118] Step R2: Enhance the representation of the time series by combining positional encoding.
[0119] Introduce positional encoding to preserve the time dependencies of the time series.
[0120] The model training and optimization unit 250 is used to train and optimize the model after completing the time-dependency modeling.
[0121] The model training and optimization unit 250 performs the following sub-steps: Step Y1: Select the loss function.
[0122] Use the mean squared error (MSE) or cross-entropy as the loss function.
[0123] Step Y2: Apply the regularization strategy.
[0124] Add Dropout or L2 regularization to avoid overfitting of the model.
[0125] Step Y3: Select the optimizer.
[0126] Use the Adam optimizer and set the learning rate scheduler (such as ReduceLROnPlateau) to dynamically adjust the learning rate.
[0127] The prediction and evaluation unit 260 is used to perform prediction and evaluation according to the trained and optimized model.
[0128] Among them, the prediction and evaluation unit 260 performs the following sub-steps: Step D1: Input the test set data, and the trained and optimized model outputs the prediction result.
[0129] Among them, the output prediction result can be compared with the true value to test the prediction accuracy. If the accuracy is less than the specified threshold, it means that the prediction accuracy is low, and then step S62 is executed.
[0130] Among them, after the prediction result is output, the accuracy of the prediction result needs to be verified. If the immediate comparison between the prediction result and the true value cannot be completed temporarily, there may be a loss of the prediction result due to device power-off, thus unable to complete the verification of the prediction accuracy. Therefore, this embodiment also includes temporarily storing the output prediction result.
[0131] Since the prediction result can be the dissolved oxygen, flow rate, rainfall, etc. in a future time period, this embodiment regards the prediction result as a file form, selects a specified number of nodes in the device for storing the prediction result, and stores the prediction result in a specified node.
[0132] Among them, first select a specified number of starting nodes and transmission nodes. Determine the optimal path among multiple starting nodes and transmission nodes, and store the prediction result in the storage node according to the optimal path.
[0133] Specifically, determine the transmission cost of directly transmitting data between the starting node and the storage node , because there may be a long transmission distance between the starting node and the storage node, so when determining the transmission cost , the transmission distance is also used as a reference parameter, specifically expressed as: ; Among them represents the transmission bandwidth from the starting node i to the storage node o, represents the transmission distance from the starting node i to the storage node o, represents the probability of random failure of the starting node i.
[0134] Determine the transmission cost between the starting node passing through the transmission node and reaching the storage node, specifically expressed as : ; Among them represents the transmission bandwidth from the starting node i to the transmission node j, represents the transmission bandwidth from the transmission node j to the storage node o, Represents the probability of random failure of the starting node i, Represents the probability of random failure of the transmission node j.
[0135] When is greater than then it is selected that the starting node directly transmits the prediction result to the storage node for storage.
[0136] When is less than then it is selected that the starting node transmits the data to the transmission node, and the data is transmitted to the storage node through the transmission node.
[0137] Step D2: Perform performance evaluation after outputting the prediction result.
[0138] Among them, the performance evaluation includes examining the prediction accuracy, robustness, and computational efficiency of the model.
[0139] Specifically, it can be implemented using scikit - learn of Python or custom code for evaluation.
[0140] This application has the following beneficial effects: This application, through the collaborative modeling of introducing differential and inverted attention mechanisms, effectively extracts global dependencies through variable - dimension modeling by the inverted attention mechanism. Through the differential attention mechanism, noise interference is significantly reduced through difference calculation, and the ability to extract key features is improved. At the same time, the combined action of the two mechanisms significantly enhances the modeling ability for long - sequence data. The lightweight design of the model adapts to the application scenarios of large - scale time - series data. And it has stronger adaptability to non - stationary data and complex systems, and has a wider range of applicability.
[0141] Although the examples referred to in the current application are described, they are only for the purpose of explanation and not a limitation of the present application. Changes, additions, and / or deletions to the implementation manners can be made without departing from the scope of the present application.
[0142] As described above, it is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for predicting multi-variable time series of water quality during the flood season, characterized in that, It includes the following steps: Obtain data and perform data preprocessing; After completing data preprocessing, perform inverted attention mechanism modeling; After completing inverted attention mechanism modeling, perform differential attention enhancement; After completing differential attention enhancement, perform time-dependence modeling; After completing time-dependence modeling, perform model training and optimization; Perform prediction and evaluation according to the trained and optimized model.
2. The flood season water quality multi-variable time series prediction method according to claim 1, wherein Obtaining data includes obtaining hydrometeorological data and water quality index data.
3. The flood season water quality multi-variable time series prediction method according to claim 1, wherein Performing data preprocessing includes the following sub-steps: Perform normalization processing; Perform missing value filling; Perform feature grouping; Perform reconstruction of the input matrix.
4. The flood season water quality multivariable time series prediction method according to claim 1, wherein Performing inverted attention mechanism modeling includes the following sub-steps: Construct an input sequence centered on variables; Calculate the global attention distribution among variables.
5. The flood season water quality multivariable time series prediction method according to claim 1, wherein Performing differential attention enhancement includes the following sub-steps: Perform a differential operation to suppress redundant information; Perform reinforcement of important signals.
6. A multivariate time series prediction system for flood season water quality, characterized in that, It includes: A preprocessing unit, an inverted attention mechanism modeling unit, a differential attention enhancement unit, a time-dependence modeling unit, a model training and optimization unit, and a prediction and evaluation unit; The preprocessing unit is used to obtain data and perform data preprocessing; The inverted attention mechanism modeling unit is used to perform inverted attention mechanism modeling; The differential attention enhancement unit is used to perform differential attention enhancement; The time-dependence modeling unit is used to perform time-dependence modeling; The model training and optimization unit is used to perform model training and optimization; The prediction and evaluation unit is used to perform prediction and evaluation according to the trained and optimized model.
7. The flood season water quality multi-variable time series prediction system according to claim 6, characterized in that The data obtained by the preprocessing unit includes obtaining hydrometeorological data and water quality index data.
8. The flood season water quality multi-variable time series prediction system according to claim 6, characterized in that, The preprocessing unit performing data preprocessing includes the following sub-steps: Perform normalization processing; Perform missing value filling; Perform feature grouping; Perform reconstruction of the input matrix.
9. The flood season water quality multivariable time series prediction system according to claim 6, characterized in that, The inverted attention mechanism modeling unit performing inverted attention mechanism modeling includes the following sub-steps: Construct an input sequence centered on variables; Calculate the global attention distribution among variables.
10. The flood season water quality multi-variable time series prediction system according to claim 6, wherein The differential attention enhancement unit performing differential attention enhancement includes the following sub-steps: Perform a differential operation to suppress redundant information; Perform reinforcement of important signals.
Citation Information
Patent Citations
River water quality prediction method considering space-time correlation and meteorological factors
CN112381292A
Time sequence prediction method based on differential fusion Transform
CN114841072A
Multivariable time sequence prediction method based on maximized mutual information entropy improvement
CN116976490A
Multispectral pedestrian detection method based on differential attention and frequency domain fusion
CN117710899A
Intelligent prediction method for surface turbulence flux based on iTransform
CN119129429A
Cited By
Modal decomposition and deep learning-based rainstorm torrential flood disaster-causing element prediction method and system
CN120745926A